\r
\r
#region Public Methods\r
-\r
public bool IsCellOpen(Point point)\r
{\r
if (!State.Map.IsCellOpen(point)) return false;\r
allCharactersSelected = false;\r
if (State.GetKeysDown(i).Contains(Keys.Enter))\r
{\r
- State.mCharacters[i] = new Human(this, "", State.Map.GetStartingPositionForPlayer(i + 1));\r
+ State.mCharacters[i] = new Human(this, "", State.Map.GetStartingPositionForPlayer(i + 1), i);\r
State.mCharacters[i].LoadContent(mContentManager);\r
}\r
}\r
//Used to draw projectiles\r
int projectileSpeed;\r
int projectileCoolDown;\r
+ int mPlayerIndex;\r
\r
\r
- public Human(Game theGame, String Name, Point position)\r
+ public Human(Game theGame, String Name, Point position, int playerIndex)\r
{\r
game = theGame;\r
CharName = Name;\r
score = 0;\r
visible = false;\r
projectileSpeed = 8;\r
+ mPlayerIndex = playerIndex;\r
\r
// Speed is the number of grid cells you can move through per second.\r
mMotion = new MovementManager(position, 4.0f);\r
toShoot.Normalize();\r
toShoot *= projectileSpeed;\r
projectileCoolDown = shootCoolDown;\r
- game.State.mDisplay.AddProjectiles(new Projectile(game.State.Map, projectileModel,\r
- toShoot, new Point(startX, startY)));\r
+ game.State.mDisplay.AddProjectiles(new Projectile(game, projectileModel,\r
+ toShoot, new Point(startX, startY), mPlayerIndex));\r
\r
\r
}\r
public class Projectile\r
{\r
//Member Variables\r
- Map theMap;\r
Vector2 velocity;\r
Texture2D projectileModel;\r
int damage;\r
int pixelY;\r
MovementManager mMotion;\r
Point mPosition;\r
+ int mCharacterIndex;\r
+ Game mGame;\r
\r
/// <summary>\r
/// The Constructor for a projectile object.\r
/// <param name="_gridY">The starting Y position in the map grid</param>\r
/// <param name="_pixelX">The absolute X pixel position on the map</param>\r
/// <param name="_pixelY"> The absolute Y pixel position on the map</param>\r
- public Projectile(Map _currentMap,\r
+ public Projectile(Game theGame,\r
Texture2D _projectileModel,\r
Vector2 _velocity,\r
- Point _position)\r
+ Point _position,\r
+ int characterNumber)\r
\r
{\r
- theMap = _currentMap;\r
+ mGame = theGame;\r
+ mCharacterIndex = characterNumber;\r
projectileModel = _projectileModel;\r
velocity = _velocity;\r
mPosition = _position;\r
/// <param name="topLeftY">The map Y pixel position of the topLeft of the display</param>\r
public void Draw(SpriteBatch spriteBatch)\r
{\r
- Rectangle position = theMap.GetRectangleFromCoordinates(mMotion.Position);\r
+ Rectangle position = mGame.State.Map.GetRectangleFromCoordinates(mMotion.Position);\r
spriteBatch.Draw(projectileModel, position, Color.White);\r
\r
}\r
public int GridY { get { return gridY; } set { gridY = value; } }\r
public int PixelX { get { return pixelX; } set { pixelX = value; } }\r
public int PixelY { get { return pixelY; } set { pixelY = value; } }\r
- public Map TheMap { get { return theMap; } set { theMap = value; } }\r
public int Damage { get { return damage; } set { damage = value; } }\r
public Vector2 Position { get { return mMotion.Position; } }\r
public Point Coordinates { get { return mMotion.Coordinates; } }\r