netwar.game
Class Player

java.lang.Object
  |
  +--netwar.game.Player

public class Player
extends java.lang.Object

Class representing a single Player's data. This is in-game data including a reference to the Base, as well as data taken from the PlayerSettings.

Author:
Group N2 - Project Netwar, Daniel Grund
See Also:
PlayerSettings

Constructor Summary
Player(int pNumber, int baseX, int baseY, java.awt.Color tColor, boolean isLocal)
          Creates a new instance of Player.
 
Method Summary
 boolean baseDead()
          Checks if this player's base is dead
static boolean EndGame()
          Checks if there are enough players to continue the game.
 Base getBase()
          Accessor for TeamBase
 java.awt.Color getColor()
          Returns the team color
static Player getLocal()
          Returns the local player
 int getNumber()
          Returns this player's number.
static Player getPlayer(int pNum)
          Returns the player with number pNum
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Player

public Player(int pNumber,
              int baseX,
              int baseY,
              java.awt.Color tColor,
              boolean isLocal)
Creates a new instance of Player. Should only be called by startGame, in player number order
Method Detail

EndGame

public static boolean EndGame()
Checks if there are enough players to continue the game.
Returns:
true if there are one or zero players with bases.

baseDead

public boolean baseDead()
Checks if this player's base is dead
Returns:
true if the base is dead.

getBase

public Base getBase()
Accessor for TeamBase
Returns:
the Base for this player, if it is still alive.

getLocal

public static Player getLocal()
Returns the local player
Returns:
the local player.

getPlayer

public static Player getPlayer(int pNum)
Returns the player with number pNum
Parameters:
pNum - the number of the desired player
Returns:
the player

getNumber

public int getNumber()
Returns this player's number. Used in network communications.
Returns:
the player's number.

getColor

public java.awt.Color getColor()
Returns the team color
Returns:
A java.awt.Color