2 using System.Collections.Generic;
5 using Microsoft.Xna.Framework;
6 using Microsoft.Xna.Framework.Content;
7 using Microsoft.Xna.Framework.Graphics;
8 using Microsoft.Xna.Framework.Input;
12 public class Human : IPlayer
30 public Human(Map _theMap, String Name)
35 movementSpeed = 20; // randomly set now
41 public void LoadContent(ContentManager contentManager)
43 charModel = contentManager.Load<Texture2D>("deselectBox"); //change to charModel when designed
46 public void UnloadContent()
51 public long Update(GameTime gameTime, NetworkManager networkGame)
57 public long Draw(SpriteBatch spriteBatch)
59 spriteBatch.Draw(charModel, theMap.GetRectangleFromCoordinates(gridX, gridY), Color.White);
63 public int GridX { get { return gridX; } set { gridX = value; } }
64 public int GridY { get { return gridY; } set { gridY = value; } }
65 public int Health { get { return health; } }
66 public int Score { get { return score; } }
67 public bool alive { get { return health > 0; } }
69 public void causeDamageTo(int amount)
75 /// Moves the current player being controlled based on a given set of key presses.
76 /// The player can only move one grid space per movePlayer call. Thus this method
77 /// is made to be called ever update. The player will only move if the grid space
78 /// that is being moved to is an open space.
80 /// <param name="keysPressed">A general list of keys that are pressed. Other keys can be included but only direction keys will be used</param>
81 public void MovePlayer(List<Keys> keysPressed)
84 keysPressed.Contains<Keys>(Keys.Left);
85 if (keysPressed.Contains<Keys>(Keys.Up) && keysPressed.Contains<Keys>(Keys.Left) && theMap.IsCellOpen(gridX - 1, gridY - 1))
91 else if (keysPressed.Contains<Keys>(Keys.Up) && keysPressed.Contains<Keys>(Keys.Right) && theMap.IsCellOpen(gridX + 1, gridY - 1))
97 else if (keysPressed.Contains<Keys>(Keys.Down) && keysPressed.Contains<Keys>(Keys.Left) && theMap.IsCellOpen(gridX - 1, gridY + 1))
103 else if (keysPressed.Contains<Keys>(Keys.Down) && keysPressed.Contains<Keys>(Keys.Right) && theMap.IsCellOpen(gridX + 1, gridY + 1))
109 else if (keysPressed.Contains<Keys>(Keys.Up) && theMap.IsCellOpen(gridX, gridY - 1))
114 else if (keysPressed.Contains<Keys>(Keys.Down) && theMap.IsCellOpen(gridX, gridY + 1))
119 else if (keysPressed.Contains<Keys>(Keys.Left) && theMap.IsCellOpen(gridX - 1, gridY))
124 else if (keysPressed.Contains<Keys>(Keys.Right) && theMap.IsCellOpen(gridX + 1, gridY))
131 public void powerUp(int amount)
136 public void Spawn(Vector2 spawn)
138 gridX = (int)spawn.X;
139 gridY = (int)spawn.Y;