const int hitCoolDown = 18;\r
const int baseHealth = 200;\r
const int baseDamage = 30;\r
+ int coolDown;\r
Texture2D charModel;\r
Texture2D projectileModel;\r
#endregion \r
public Melee(Game theGame, String Name, Point position, int playerIndex)\r
: base(theGame, Name, position, playerIndex, baseHealth, baseDamage)\r
{\r
- projectileSpeed = 8;\r
+ coolDown = hitCoolDown;\r
}\r
#endregion\r
\r
\r
public override void Attack(List<Keys> keysPressed)\r
{\r
- if (hitCoolDown > 0)\r
- hitCoolDown--;\r
- else if (hitCoolDown == 0)\r
+ if (coolDown > 0)\r
+ coolDown--;\r
+ else if (coolDown == 0)\r
{\r
if (keysPressed.Contains<Keys>(Keys.Space))\r
{\r
}\r
\r
\r
+ }\r
+ public override void PlayAttackSound()\r
+ {\r
+\r
+ }\r
+ public override void PlayDieSound()\r
+ {\r
+\r
}\r
#endregion\r
}\r
\r
namespace CarFire\r
{\r
- public class Player : ICharacter\r
+ public abstract class Player : ICharacter\r
{\r
#region Member variables\r
//The number of frames between each projectile is spawned.\r
int mPlayerIndex;\r
#endregion\r
\r
+ #region Public Properties\r
+ public int Health { get { return playerHealth; } set{playerHealth = value;} }\r
+ public int Score { get { return score; } }\r
+ public bool alive { get { return playerHealth > 0; } }\r
+ public Game Game { get { return game; } }\r
+ public MovementManager Motion { get { return mMotion; } }\r
+ public int PlayerIndex { get { return mPlayerIndex; } }\r
+ public Vector2 Position { get { return mMotion.Position; } }\r
+ public Point Coordinates { get { return mMotion.Coordinates; } }\r
+ public int Damage { get { return playerDamage; } set { playerDamage = value; } }\r
+ #endregion\r
\r
+ #region Public Methods\r
public Player(Game theGame, String Name, Point position, int playerIndex, int health, int damage)\r
{\r
game = theGame;\r
// Speed is the number of grid cells you can move through per second.\r
mMotion = new MovementManager(position, 4.0f);\r
}\r
-\r
- public virtual void LoadContent(ContentManager contentManager)\r
- {\r
-\r
- }\r
- /// <summary>\r
- /// This method will draw a character to the screen.\r
- /// </summary>\r
- /// <param name="spriteBatch"></param>\r
- public virtual void Draw(SpriteBatch spriteBatch)\r
- {\r
- }\r
-\r
- public int Health { get { return playerHealth; } }\r
- public int Score { get { return score; } }\r
- public bool alive { get { return playerHealth > 0; } }\r
- public Game Game { get { return game; } }\r
- public MovementManager Motion { get { return mMotion; } }\r
- public int PlayerIndex { get { return mPlayerIndex; } }\r
- public Vector2 Position { get { return mMotion.Position; } }\r
- public Point Coordinates { get { return mMotion.Coordinates; } }\r
- public int Damage { get { return playerDamage; } }\r
-\r
public void causeDamageTo(int amount)\r
{\r
playerHealth -= amount;\r
mMotion.LockUpdate(timeSpan, moveLeft, moveRight, moveUp, moveDown);\r
}\r
}\r
- public virtual void Attack(List<Keys> keysPressed)\r
- {\r
- \r
- }\r
+ \r
public void powerUp(int amount)\r
{\r
playerHealth += amount;\r
\r
public void Spawn(Vector2 spawn)\r
{\r
- \r
+\r
}\r
+ public void AddHealth(int healthBoost)\r
+ {\r
+ Health += healthBoost;\r
+ }\r
+ public void IncreaseDamage(int damageBoost)\r
+ {\r
+ Damage += damageBoost;\r
+ }\r
+ #endregion\r
+\r
+ #region Abstract Methods\r
+ public abstract void PlayAttackSound();\r
+ public abstract void PlayDieSound();\r
+ public abstract void LoadContent(ContentManager contentManager);\r
+ /// <summary>\r
+ /// This method will draw a character to the screen.\r
+ /// </summary>\r
+ /// <param name="spriteBatch"></param>\r
+ public abstract void Draw(SpriteBatch spriteBatch);\r
+ public abstract void Attack(List<Keys> keysPressed);\r
+ #endregion\r
\r
\r
}\r
{\r
public class Ranged : Player\r
{\r
+ #region Member Variables\r
//The number of frames between each projectile is spawned.\r
const int shootCoolDown = 18;\r
const int baseHealth = 100;\r
//Used to draw projectiles\r
int projectileSpeed;\r
int projectileCoolDown;\r
+ #endregion\r
\r
-\r
+ #region Public Methods\r
public Ranged(Game theGame, String Name, Point position, int playerIndex)\r
: base(theGame, Name, position, playerIndex, baseHealth, baseDamage)\r
{\r
projectileSpeed = 8;\r
}\r
+ #endregion\r
\r
+ #region Overridden Methods From Player\r
public override void LoadContent(ContentManager contentManager)\r
{\r
charModel = contentManager.Load<Texture2D>("cs"); //change to charModel when designed\r
\r
\r
}\r
- \r
+ public override void PlayAttackSound()\r
+ {\r
+\r
+ }\r
+ public override void PlayDieSound()\r
+ {\r
+\r
+ }\r
+ #endregion \r
\r
\r
}\r