1 using System;
    2 using System.Collections.Generic;
    3 using System.Linq;
    4 using System.Text;
    5 using Microsoft.Xna.Framework;
    6 using Microsoft.Xna.Framework.Graphics;
    7 
    8 namespace BrawlerGame
    9 {
   10     abstract public class Entity
   11     {
   12         #region Fields
   13 
   14         protected Vector2 ePosition;  // position of entity
   15         protected float eSpeed;       // speed of movement
   16         protected float eGravity;     // gravity
   17         protected int eHealth;        // health of entity
   18         protected int eDamage;        // damage of entity
   19         protected int eScore;         // score of entity
   20         protected bool eMoving;       // if true, the entity is moving
   21         protected bool eIsAlive;      // if true, the entity is alive
   22         protected byte eDirection;    // direction of entity
   23         protected bool moveLevel;     // allow background to move
   24         public int screenWidth;       // maximum X position for the entity
   25         public int screenHeight;      // maximum Y position for the entity
   26 
   27         #endregion
   28 
   29 
   30         #region Properties
   31         public Vector2 Position
   32         {
   33             get { return ePosition; }
   34             set { ePosition = value; }
   35         }
   36 
   37         public float Speed
   38         {
   39             get { return eSpeed; }
   40             set { eSpeed = value; }
   41         }
   42 
   43         public float Gravity
   44         {
   45             get { return eGravity; }
   46             set { eGravity = value; }
   47         }
   48 
   49         public int Health
   50         {
   51             get { return eHealth; }
   52             set { eHealth = value; }
   53         }
   54 
   55         public int Damage
   56         {
   57             get { return eDamage; }
   58             set { eDamage = value; }
   59         }
   60 
   61         public int Score
   62         {
   63             get { return eScore; }
   64             set { eScore = value; }
   65         }
   66 
   67         public bool IsMoving
   68         {
   69             get { return eMoving; }
   70             set { eMoving = value; }
   71         }
   72 
   73         public bool IsAlive
   74         {
   75             get { return eIsAlive; }
   76             set { eIsAlive = value; }
   77         }
   78 
   79         public byte Direction
   80         {
   81             get { return eDirection; }
   82             set { eDirection = value; }
   83         }
   84 
   85         public bool AdvanceLevel
   86         {
   87             get { return moveLevel; }
   88             set { moveLevel = value; }
   89         }
   90         #endregion
   91 
   92 
   93         #region Initialize
   94         public Entity()
   95         {
   96             ePosition = Vector2.Zero;       // position of entity
   97             eSpeed = 0.0f;                  // speed of movement
   98             eGravity = 0.0f;                // gravity
   99             eHealth = 0;                    // health of entity
  100             eDamage = 0;                    // damage of entity
  101             eMoving = false;                // if true, the entity is moving
  102             eIsAlive = true;                // if true, the entity is alive
  103             eDirection = 0;                 // 0 = right;  1 = left
  104             moveLevel = false;              // enemies are alive, don't move
  105             eScore = 0;
  106         }
  107 
  108         public virtual void LoadContent(GraphicsDevice graphics)
  109         {
  110             screenWidth = (int)(graphics.Viewport.Width);
  111             screenHeight = (int)(graphics.Viewport.Height);
  112         }
  113         #endregion
  114 
  115 
  116         #region Update
  117         public virtual void Update(GameTime gTime)
  118         {
  119             if (eHealth <= 0)
  120             {
  121                 eIsAlive = false;
  122             }
  123             else
  124                 eIsAlive = true;
  125         }
  126 
  127         public virtual void Update(GameTime gTime, Entity player)
  128         {
  129             if (eHealth <= 0)
  130             {
  131                 eIsAlive = false;
  132             }
  133             else
  134                 eIsAlive = true;
  135         }
  136         #endregion
  137 
  138 
  139         #region Draw
  140         public virtual void Draw(SpriteBatch spritebatch)
  141         {
  142 
  143         }
  144         #endregion
  145     }
  146 }