Added a Gaia player and added some random stones
This commit is contained in:
parent
397fb7ebd0
commit
65747bd267
40 changed files with 1316 additions and 45 deletions
|
|
@ -2,11 +2,14 @@ package ei.game.player;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import ei.engine.scene.Node;
|
||||
|
||||
public class PlayerHandler {
|
||||
// The instance of this class
|
||||
private static PlayerHandler instance;
|
||||
// The player list
|
||||
private ArrayList<Player> players;
|
||||
private Node playerNode;
|
||||
|
||||
/**
|
||||
* Creates a PlayerHandler
|
||||
|
|
@ -14,6 +17,16 @@ public class PlayerHandler {
|
|||
*/
|
||||
public PlayerHandler(){
|
||||
players = new ArrayList<Player>();
|
||||
playerNode = new Node("PlayerNode");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a node with all the players units
|
||||
*
|
||||
* @return A node with all the players units
|
||||
*/
|
||||
public Node getNode(){
|
||||
return playerNode;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -25,6 +38,7 @@ public class PlayerHandler {
|
|||
public boolean addPlayer(Player p){
|
||||
if(!players.contains(p)){
|
||||
players.add(p);
|
||||
playerNode.add(p.getNode());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -38,6 +52,7 @@ public class PlayerHandler {
|
|||
public boolean removePlayer(Player p){
|
||||
if(players.contains(p)){
|
||||
players.remove(p);
|
||||
playerNode.remove(p.getNode());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue