using System; using System.Collections.Generic; using System.Text; using FlatRedBall; using FlatRedBall.Math.Geometry; namespace FlatRedBall_XNA_Template1 { public class Entity : PositionedObject { #region Fields private Sprite mVisibleRepresentation; private Circle mCollision; #endregion #region Properties #region XML Docs /// /// The collision of the object - can be used to perform collisions between entities. /// #endregion public Circle Collision { get { return mCollision; } } #endregion #region Methods #region XML Docs /// /// Creates the Entitity and adds it to the SpriteManager. Also adds /// its components to their respective managers. /// /// /// Be sure to call Destroy when done with this object so it cleans itself up. /// /// The content manager name to use for loading data. #endregion public Entity(string contentManagerName) { SpriteManager.AddPositionedObject(this); mVisibleRepresentation = SpriteManager.AddSprite("redball.bmp", contentManagerName); mVisibleRepresentation.AttachTo(this, false); mCollision = ShapeManager.AddCircle(); mCollision.AttachTo(this, false); } #region XML Docs /// /// Removes this and all of its components from their respective managers. /// #endregion public void Destroy() { SpriteManager.RemovePositionedObject(this); SpriteManager.RemoveSprite(mVisibleRepresentation); ShapeManager.Remove(mCollision); } #endregion } }