All pastes #967038 Raw Edit

Vic

public text v1 · immutable
·published 2008-04-02 04:26 UTC
rendered paste body
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
        /// <summary>
        /// The collision of the object - can be used to perform collisions between entities.
        /// </summary>
        #endregion
        public Circle Collision
        {
            get { return mCollision; }
        }

        #endregion

        #region Methods

        #region XML Docs
        /// <summary>
        /// Creates the Entitity and adds it to the SpriteManager.  Also adds
        /// its components to their respective managers.
        /// </summary>
        /// <remarks>
        /// Be sure to call Destroy when done with this object so it cleans itself up.
        /// </remarks>
        /// <param name="contentManagerName">The content manager name to use for loading data.</param>
        #endregion
        public Entity(string contentManagerName)
        {
            SpriteManager.AddPositionedObject(this);
            
            mVisibleRepresentation = SpriteManager.AddSprite("redball.bmp", contentManagerName);
            mVisibleRepresentation.AttachTo(this, false);

            mCollision = ShapeManager.AddCircle();
            mCollision.AttachTo(this);
        }

        #region XML Docs
        /// <summary>
        /// Removes this and all of its components from their respective managers.
        /// </summary>
        #endregion
        public void Destroy()
        {
            SpriteManager.RemovePositionedObject(this);
            SpriteManager.RemoveSprite(mVisibleRepresentation);
            ShapeManager.Remove(mCollision);
        }

        #endregion
    }
}