Merge branch 'master' of https://github.com/SemvdH/netwerk-programming-eindopdracht
This commit is contained in:
@@ -389,8 +389,9 @@ public class MainGame extends Game implements ClientCallback {
|
||||
|
||||
} else if (data instanceof ReadyData) {
|
||||
ReadyData readyData = (ReadyData) data;
|
||||
if (readyData.getUsername().equals(this.username)) {
|
||||
|
||||
if (!readyData.getUsername().equals(this.username)) {
|
||||
this.enemyReady = true;
|
||||
System.out.println("enemy is ready");
|
||||
}
|
||||
} else if (data instanceof MoveData) {
|
||||
MoveData moveData = (MoveData) data;
|
||||
@@ -403,6 +404,23 @@ public class MainGame extends Game implements ClientCallback {
|
||||
|
||||
}
|
||||
|
||||
public void chooseHacker() {
|
||||
System.out.println("chose HACKER");
|
||||
setChosenFaction(Faction.HACKER);
|
||||
send(new TeamData(Faction.MEGACORPORATION, getUsername()));
|
||||
// mainGame.initCharacters();
|
||||
// camera.translate(-400, 0);
|
||||
// mainGame.setGamestate(GAMESTATE.PLAYING);
|
||||
}
|
||||
|
||||
public void chooseMegaCorp() {
|
||||
System.out.println("chose MEGA CORP");
|
||||
setChosenFaction(Faction.MEGACORPORATION);
|
||||
send(new TeamData(Faction.MEGACORPORATION, getUsername()));
|
||||
// mainGame.initCharacters();
|
||||
// mainGame.setGamestate(GAMESTATE.PLAYING);
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,15 @@ public class Team {
|
||||
return null;
|
||||
}
|
||||
|
||||
public GameCharacter get(String username) {
|
||||
for (GameCharacter cur : this.members) {
|
||||
if (cur.getName().equals(username)) {
|
||||
return cur;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public GameCharacter get(int position) {
|
||||
if (position >= this.members.getSize()) {
|
||||
throw new IndexOutOfBoundsException("position out of range");
|
||||
|
||||
@@ -119,19 +119,10 @@ public class GameInputProcessor implements InputProcessor {
|
||||
}
|
||||
} else if (mainGame.getGamestate() == GAMESTATE.SELECTING_FACTION) {
|
||||
if (keycode == Input.Keys.NUM_1) {
|
||||
System.out.println("chose MEGA CORP");
|
||||
mainGame.setChosenFaction(Faction.MEGACORPORATION);
|
||||
mainGame.send(new TeamData(Faction.MEGACORPORATION, mainGame.getUsername()));
|
||||
// mainGame.initCharacters();
|
||||
// mainGame.setGamestate(GAMESTATE.PLAYING);
|
||||
mainGame.chooseMegaCorp();
|
||||
}
|
||||
if (keycode == Input.Keys.NUM_2) {
|
||||
System.out.println("chose HACKER");
|
||||
mainGame.setChosenFaction(Faction.HACKER);
|
||||
mainGame.send(new TeamData(Faction.MEGACORPORATION, mainGame.getUsername()));
|
||||
// mainGame.initCharacters();
|
||||
// camera.translate(-400, 0);
|
||||
// mainGame.setGamestate(GAMESTATE.PLAYING);
|
||||
mainGame.chooseHacker();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user