unc.cdva.gameengine.entities
Class Player

java.lang.Object
  extended by unc.cdva.utils.TaggedObject
      extended by unc.cdva.gameengine.entities.Player
All Implemented Interfaces:
Taggable

public class Player
extends TaggedObject

Abstract representation of a player, or a user. Use to encapsulate the attributes of a player. Implemented with a bean design.

Author:
Dan Van Atta, Guillaume Conte

Constructor Summary
Player()
          Initializes a player object, starts the level and score at zero, and tags the player as active.
 
Method Summary
 void addToScore(long score)
          Increases the players score.
 boolean equals(java.lang.Object o)
          Returns true if the parameter is a player object that has the same id as this player object.
 long getHighScore()
           
 int getLevel()
           
 long getScore()
           
 void init()
          Resets a player object, the player will have no score and will be on the first level.
 boolean isActive()
          A getter method for the active property of Player.
 boolean isFiring()
           
 void nextLevel()
          Increments the level property by one.
 void setActive(boolean active)
          Setter for the active property of Player.
 void setFiring(boolean firing)
           
 void setHighScore(long hiScore)
           
 void setLevel(int level)
           
 void setScore(long score)
           
 
Methods inherited from class unc.cdva.utils.TaggedObject
createId, getId, hashCode, setId, setId
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Player

public Player()
Initializes a player object, starts the level and score at zero, and tags the player as active.

Method Detail

init

public void init()
Resets a player object, the player will have no score and will be on the first level.


equals

public boolean equals(java.lang.Object o)
Returns true if the parameter is a player object that has the same id as this player object.

Overrides:
equals in class TaggedObject

isActive

public boolean isActive()
A getter method for the active property of Player.

Returns:
The value of the active field.

setActive

public void setActive(boolean active)
Setter for the active property of Player.

Parameters:
active - Pass in false to indicate that the player is not active, true to indicate the player is still active.

addToScore

public void addToScore(long score)
Increases the players score.

Parameters:
score - The amount to increase the players score by.

getHighScore

public long getHighScore()
Returns:
the hiScore

getLevel

public int getLevel()
Returns:
the level

getScore

public long getScore()
Returns:
the player's current score.

setHighScore

public void setHighScore(long hiScore)
Parameters:
hiScore - the hiScore to set

setLevel

public void setLevel(int level)
Parameters:
level - the level to set

setScore

public void setScore(long score)
Parameters:
score - the score to set

nextLevel

public void nextLevel()
Increments the level property by one.


isFiring

public boolean isFiring()

setFiring

public void setFiring(boolean firing)