using System; using Icarus.Logic.Physics; using Icarus.Graphics.Animation; namespace Icarus.Logic { /// /// 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. /// public class ChildObject: WorldObject { #region Data /// /// The anchor point for the child. /// private Point mAnchorPoint; /// /// The parent world object. /// private WorldObject mParent; #endregion #region Fields /// /// Anchor Point. The anchor point is the coordinate of the parent object where the top-left corner of the child goes. /// public Point AnchorPoint { get { return mAnchorPoint; } set { mAnchorPoint = value; } } /// /// The parent of the child object. /// [System.Xml.Serialization.XmlIgnore] public WorldObject Parent { get { return mParent; } set { mParent = value; } } /// /// The location of the child component. /// public override Point Location { get { return this.Parent.Location.Add(this.AnchorPoint); } } /// /// Velocity of the child component. /// public override Vector Velocity { get { return this.Parent.Velocity; } } #endregion } }