X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=CarFire%2FCarFire%2FCarFire%2FHuman.cs;h=0d65d494a744cdfaf4b5a7e609af887431139200;hb=b3adecad08c0bb066d6efe041835a9636a96b066;hp=08d962a1e682042ef420fab99b59b8fb52815d78;hpb=af9deb873b24dadd0d509ce199fc6cac2b3efbc9;p=chaz%2Fcarfire diff --git a/CarFire/CarFire/CarFire/Human.cs b/CarFire/CarFire/CarFire/Human.cs index 08d962a..0d65d49 100644 --- a/CarFire/CarFire/CarFire/Human.cs +++ b/CarFire/CarFire/CarFire/Human.cs @@ -11,16 +11,8 @@ namespace CarFire { public class Human : IPlayer { - public enum State - { - left, - right, - up, - down - }; //The number of frames between each projectile is spawned. - const int shootCoolDown = 10; - State state; + const int shootCoolDown = 18; String CharName; Game game; Texture2D charModel; @@ -31,37 +23,32 @@ namespace CarFire int score; MovementManager mMotion; - bool visible; - Display theDisplay; //Used to draw projectiles int projectileSpeed; int projectileCoolDown; + int mPlayerIndex; - public Human(Game theGame, String Name, Texture2D model, Texture2D projectile, Display mDisplay, Point position) + public Human(Game theGame, String Name, Point position, int playerIndex) { game = theGame; CharName = Name; - theDisplay = mDisplay; health = 100; score = 0; visible = false; - //default state - state = State.up; - charModel = model; - projectileModel = projectile; - projectileSpeed = 30; + projectileSpeed = 8; + mPlayerIndex = playerIndex; // Speed is the number of grid cells you can move through per second. - mMotion = new MovementManager(position, 8.0f); + mMotion = new MovementManager(position, 4.0f); } public void LoadContent(ContentManager contentManager) { - charModel = contentManager.Load("deselectBox"); //change to charModel when designed - projectileModel = contentManager.Load("emptySelectBox"); //change to a projectile model later + charModel = contentManager.Load("cs"); //change to charModel when designed + projectileModel = contentManager.Load("projectile"); //change to a projectile model later } @@ -104,15 +91,6 @@ namespace CarFire bool moveRight = keysPressed.Contains(Keys.Right); bool moveUp = keysPressed.Contains(Keys.Up); bool moveDown = keysPressed.Contains(Keys.Down); - if (moveLeft) - state = State.left; - else if (moveRight) - state = State.right; - else if (moveUp) - state = State.up; - else if (moveDown) - state = State.down; - Point destination = MovementManager.GetNeighborCell(mMotion.Coordinates, moveLeft, moveRight, moveUp, moveDown); if (!keysPressed.Contains(Keys.LeftControl)) { @@ -165,35 +143,10 @@ namespace CarFire toShoot.Normalize(); toShoot *= projectileSpeed; projectileCoolDown = shootCoolDown; - theDisplay.AddProjectiles(new Projectile(game.State.Map, projectileModel, - toShoot, new Point(startX, startY))); + game.State.mDisplay.AddProjectiles(new Projectile(game, projectileModel, + toShoot, new Point(startX, startY), mPlayerIndex)); - /* - if (state == State.up) - { - projectileCoolDown = shootCoolDown; - theDisplay.AddProjectiles(new Projectile(theMap, projectileModel, - new Vector2(0, -projectileSpeed), new Point(Coordinates.X, Coordinates.Y - 1))); - } - if (state == State.down) - { - projectileCoolDown = shootCoolDown; - theDisplay.AddProjectiles(new Projectile(theMap, projectileModel, - new Vector2(0, projectileSpeed), new Point(Coordinates.X, Coordinates.Y + 1))); - } - if (state == State.right) - { - projectileCoolDown = shootCoolDown; - theDisplay.AddProjectiles(new Projectile(theMap, projectileModel, - new Vector2(projectileSpeed, 0), new Point (Coordinates.X + 1, Coordinates.Y))); - } - if (state == State.left) - { - projectileCoolDown = shootCoolDown; - theDisplay.AddProjectiles(new Projectile(theMap, projectileModel, - new Vector2(-projectileSpeed, 0), new Point(Coordinates.X - 1, Coordinates.Y))); - } - */ + } } }