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) {
|
} else if (data instanceof ReadyData) {
|
||||||
ReadyData readyData = (ReadyData) data;
|
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) {
|
} else if (data instanceof MoveData) {
|
||||||
MoveData moveData = (MoveData) data;
|
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() {
|
public String getUsername() {
|
||||||
return username;
|
return username;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,15 @@ public class Team {
|
|||||||
return null;
|
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) {
|
public GameCharacter get(int position) {
|
||||||
if (position >= this.members.getSize()) {
|
if (position >= this.members.getSize()) {
|
||||||
throw new IndexOutOfBoundsException("position out of range");
|
throw new IndexOutOfBoundsException("position out of range");
|
||||||
|
|||||||
@@ -119,19 +119,10 @@ public class GameInputProcessor implements InputProcessor {
|
|||||||
}
|
}
|
||||||
} else if (mainGame.getGamestate() == GAMESTATE.SELECTING_FACTION) {
|
} else if (mainGame.getGamestate() == GAMESTATE.SELECTING_FACTION) {
|
||||||
if (keycode == Input.Keys.NUM_1) {
|
if (keycode == Input.Keys.NUM_1) {
|
||||||
System.out.println("chose MEGA CORP");
|
mainGame.chooseMegaCorp();
|
||||||
mainGame.setChosenFaction(Faction.MEGACORPORATION);
|
|
||||||
mainGame.send(new TeamData(Faction.MEGACORPORATION, mainGame.getUsername()));
|
|
||||||
// mainGame.initCharacters();
|
|
||||||
// mainGame.setGamestate(GAMESTATE.PLAYING);
|
|
||||||
}
|
}
|
||||||
if (keycode == Input.Keys.NUM_2) {
|
if (keycode == Input.Keys.NUM_2) {
|
||||||
System.out.println("chose HACKER");
|
mainGame.chooseHacker();
|
||||||
mainGame.setChosenFaction(Faction.HACKER);
|
|
||||||
mainGame.send(new TeamData(Faction.MEGACORPORATION, mainGame.getUsername()));
|
|
||||||
// mainGame.initCharacters();
|
|
||||||
// camera.translate(-400, 0);
|
|
||||||
// mainGame.setGamestate(GAMESTATE.PLAYING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user