From: Kyle Date: Fri, 23 Apr 2010 02:45:34 +0000 (+0000) Subject: Cleaned up a bit X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=6bc3a108ec8f47188a2bf377a23e8a64ec53eccb;p=chaz%2Fcarfire Cleaned up a bit git-svn-id: https://bd85.net/svn/cs3505_group@135 92bb83a3-7c8f-8a45-bc97-515c4e399668 --- diff --git a/CarFire/CarFire/CarFire/IPlayer.cs b/CarFire/CarFire/CarFire/IPlayer.cs index 3e20f83..6f56cef 100644 --- a/CarFire/CarFire/CarFire/IPlayer.cs +++ b/CarFire/CarFire/CarFire/IPlayer.cs @@ -24,11 +24,7 @@ namespace CarFire bool alive { get; } void Attack(); void UpdatePosition(TimeSpan timeSpan, List keysPressed); - /* - void AddHealth(int healthBoost); - void IncreaseDamage(int damageBoost); - void PlayAttackSound(); - void PlayDieSound();*/ + } public interface IMonster : ICharacter diff --git a/CarFire/CarFire/CarFire/Melee.cs b/CarFire/CarFire/CarFire/Melee.cs index 299f2e7..f461aa6 100644 --- a/CarFire/CarFire/CarFire/Melee.cs +++ b/CarFire/CarFire/CarFire/Melee.cs @@ -15,6 +15,7 @@ namespace CarFire const int hitCoolDown = 18; const int baseHealth = 200; const int baseDamage = 30; + int coolDown; Texture2D charModel; Texture2D projectileModel; #endregion @@ -23,7 +24,7 @@ namespace CarFire public Melee(Game theGame, String Name, Point position, int playerIndex) : base(theGame, Name, position, playerIndex, baseHealth, baseDamage) { - projectileSpeed = 8; + coolDown = hitCoolDown; } #endregion @@ -46,9 +47,9 @@ namespace CarFire public override void Attack(List keysPressed) { - if (hitCoolDown > 0) - hitCoolDown--; - else if (hitCoolDown == 0) + if (coolDown > 0) + coolDown--; + else if (coolDown == 0) { if (keysPressed.Contains(Keys.Space)) { @@ -57,6 +58,14 @@ namespace CarFire } + } + public override void PlayAttackSound() + { + + } + public override void PlayDieSound() + { + } #endregion } diff --git a/CarFire/CarFire/CarFire/Player.cs b/CarFire/CarFire/CarFire/Player.cs index f1d121c..0a8d4e5 100644 --- a/CarFire/CarFire/CarFire/Player.cs +++ b/CarFire/CarFire/CarFire/Player.cs @@ -10,7 +10,7 @@ using Microsoft.Xna.Framework.Input; namespace CarFire { - public class Player : ICharacter + public abstract class Player : ICharacter { #region Member variables //The number of frames between each projectile is spawned. @@ -24,7 +24,19 @@ namespace CarFire int mPlayerIndex; #endregion + #region Public Properties + public int Health { get { return playerHealth; } set{playerHealth = value;} } + public int Score { get { return score; } } + public bool alive { get { return playerHealth > 0; } } + public Game Game { get { return game; } } + public MovementManager Motion { get { return mMotion; } } + public int PlayerIndex { get { return mPlayerIndex; } } + public Vector2 Position { get { return mMotion.Position; } } + public Point Coordinates { get { return mMotion.Coordinates; } } + public int Damage { get { return playerDamage; } set { playerDamage = value; } } + #endregion + #region Public Methods public Player(Game theGame, String Name, Point position, int playerIndex, int health, int damage) { game = theGame; @@ -37,29 +49,6 @@ namespace CarFire // Speed is the number of grid cells you can move through per second. mMotion = new MovementManager(position, 4.0f); } - - public virtual void LoadContent(ContentManager contentManager) - { - - } - /// - /// This method will draw a character to the screen. - /// - /// - public virtual void Draw(SpriteBatch spriteBatch) - { - } - - public int Health { get { return playerHealth; } } - public int Score { get { return score; } } - public bool alive { get { return playerHealth > 0; } } - public Game Game { get { return game; } } - public MovementManager Motion { get { return mMotion; } } - public int PlayerIndex { get { return mPlayerIndex; } } - public Vector2 Position { get { return mMotion.Position; } } - public Point Coordinates { get { return mMotion.Coordinates; } } - public int Damage { get { return playerDamage; } } - public void causeDamageTo(int amount) { playerHealth -= amount; @@ -106,10 +95,7 @@ namespace CarFire mMotion.LockUpdate(timeSpan, moveLeft, moveRight, moveUp, moveDown); } } - public virtual void Attack(List keysPressed) - { - - } + public void powerUp(int amount) { playerHealth += amount; @@ -117,8 +103,29 @@ namespace CarFire public void Spawn(Vector2 spawn) { - + } + public void AddHealth(int healthBoost) + { + Health += healthBoost; + } + public void IncreaseDamage(int damageBoost) + { + Damage += damageBoost; + } + #endregion + + #region Abstract Methods + public abstract void PlayAttackSound(); + public abstract void PlayDieSound(); + public abstract void LoadContent(ContentManager contentManager); + /// + /// This method will draw a character to the screen. + /// + /// + public abstract void Draw(SpriteBatch spriteBatch); + public abstract void Attack(List keysPressed); + #endregion } diff --git a/CarFire/CarFire/CarFire/Ranged.cs b/CarFire/CarFire/CarFire/Ranged.cs index 874aa2f..02593ab 100644 --- a/CarFire/CarFire/CarFire/Ranged.cs +++ b/CarFire/CarFire/CarFire/Ranged.cs @@ -11,6 +11,7 @@ namespace CarFire { public class Ranged : Player { + #region Member Variables //The number of frames between each projectile is spawned. const int shootCoolDown = 18; const int baseHealth = 100; @@ -21,14 +22,17 @@ namespace CarFire //Used to draw projectiles int projectileSpeed; int projectileCoolDown; + #endregion - + #region Public Methods public Ranged(Game theGame, String Name, Point position, int playerIndex) : base(theGame, Name, position, playerIndex, baseHealth, baseDamage) { projectileSpeed = 8; } + #endregion + #region Overridden Methods From Player public override void LoadContent(ContentManager contentManager) { charModel = contentManager.Load("cs"); //change to charModel when designed @@ -88,7 +92,15 @@ namespace CarFire } - + public override void PlayAttackSound() + { + + } + public override void PlayDieSound() + { + + } + #endregion }