]> Dogcows Code - chaz/carfire/commitdiff
Cleaned up a bit
authorKyle <Kyle@92bb83a3-7c8f-8a45-bc97-515c4e399668>
Fri, 23 Apr 2010 02:45:34 +0000 (02:45 +0000)
committerKyle <Kyle@92bb83a3-7c8f-8a45-bc97-515c4e399668>
Fri, 23 Apr 2010 02:45:34 +0000 (02:45 +0000)
git-svn-id: https://bd85.net/svn/cs3505_group@135 92bb83a3-7c8f-8a45-bc97-515c4e399668

CarFire/CarFire/CarFire/IPlayer.cs
CarFire/CarFire/CarFire/Melee.cs
CarFire/CarFire/CarFire/Player.cs
CarFire/CarFire/CarFire/Ranged.cs

index 3e20f837b301aa5a2323cd8c1add51318f6a1d7e..6f56cef8863132fa8394a61e31e08303a084c77c 100644 (file)
@@ -24,11 +24,7 @@ namespace CarFire
         bool alive { get; }\r
         void Attack();\r
         void UpdatePosition(TimeSpan timeSpan, List<Keys> keysPressed);\r
-        /*\r
-        void AddHealth(int healthBoost);\r
-        void IncreaseDamage(int damageBoost);\r
-        void PlayAttackSound();\r
-        void PlayDieSound();*/\r
+        \r
     }\r
 \r
     public interface IMonster : ICharacter\r
index 299f2e79a794b9b2e18b04081eb0239cb4b8a5a6..f461aa69e8110b8b855e342a7638dcfc5c5badd8 100644 (file)
@@ -15,6 +15,7 @@ namespace CarFire
         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
@@ -23,7 +24,7 @@ namespace CarFire
         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
@@ -46,9 +47,9 @@ namespace CarFire
 \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
@@ -57,6 +58,14 @@ namespace CarFire
             }\r
 \r
 \r
+        }\r
+        public override void PlayAttackSound()\r
+        {\r
+\r
+        }\r
+        public override void PlayDieSound()\r
+        {\r
+\r
         }\r
         #endregion\r
     }\r
index f1d121c1907a0395ddeb2cab037a5b202bf4ad3f..0a8d4e54962a6d3485f391978acf2d4ff4bee109 100644 (file)
@@ -10,7 +10,7 @@ using Microsoft.Xna.Framework.Input;
 \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
@@ -24,7 +24,19 @@ namespace CarFire
         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
@@ -37,29 +49,6 @@ namespace CarFire
             // 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
@@ -106,10 +95,7 @@ namespace CarFire
                 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
@@ -117,8 +103,29 @@ namespace CarFire
 \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
index 874aa2f9ce936fab44f6aab28ada43e7e0f32b8c..02593ab706ceb3f2d1731532e4e2e367a6a2d14f 100644 (file)
@@ -11,6 +11,7 @@ namespace CarFire
 {\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
@@ -21,14 +22,17 @@ namespace CarFire
         //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
@@ -88,7 +92,15 @@ namespace CarFire
              \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
This page took 0.035606 seconds and 4 git commands to generate.