Files
TuxHunter/trunk/src/Icarus/Logic/ChildObject.cs
2025-06-07 11:39:25 -04:00

69 lines
1.5 KiB
C#

using System;
using Icarus.Logic.Physics;
using Icarus.Graphics.Animation;
namespace Icarus.Logic
{
/// <summary>
/// This is a child object. Basically, it means it's a subcomponent of another object. For instance, suppose we have the Merc world object. He could have a "whip" child object.
/// </summary>
public class ChildObject: WorldObject
{
#region Data
/// <summary>
/// The anchor point for the child.
/// </summary>
private Point mAnchorPoint;
/// <summary>
/// The parent world object.
/// </summary>
private WorldObject mParent;
#endregion
#region Fields
/// <summary>
/// Anchor Point. The anchor point is the coordinate of the parent object where the top-left corner of the child goes.
/// </summary>
public Point AnchorPoint
{
get { return mAnchorPoint; }
set { mAnchorPoint = value; }
}
/// <summary>
/// The parent of the child object.
/// </summary>
[System.Xml.Serialization.XmlIgnore]
public WorldObject Parent
{
get { return mParent; }
set { mParent = value; }
}
/// <summary>
/// The location of the child component.
/// </summary>
public override Point Location
{
get
{
return this.Parent.Location.Add(this.AnchorPoint);
}
}
/// <summary>
/// Velocity of the child component.
/// </summary>
public override Vector Velocity
{
get
{
return this.Parent.Velocity;
}
}
#endregion
}
}