- small fixes in the game
- rokets will be switched off, if not solved in time
This commit is contained in:
parent
1b69470d9c
commit
e300e2325c
|
@ -4,6 +4,7 @@ public interface IStatemachine {
|
|||
void addListener(StatemachineListener listener);
|
||||
void reset();
|
||||
Statemachine.state getCurrentState();
|
||||
Statemachine.state getLastState();
|
||||
void setNewState(Statemachine.state newState);
|
||||
int getStateChangeCounter();
|
||||
void handleInput(char input);
|
||||
|
|
|
@ -34,6 +34,7 @@ public class Statemachine implements IStatemachine {
|
|||
|
||||
private long lastHandleInput;
|
||||
private int stateChangeCounter;
|
||||
private state lastState;
|
||||
private state currentState;
|
||||
private int timertSecondsLeft;
|
||||
private int timertSeconds;
|
||||
|
@ -53,6 +54,11 @@ public class Statemachine implements IStatemachine {
|
|||
return currentState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public state getLastState() {
|
||||
return lastState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNewState(state newState) {
|
||||
currentState = newState;
|
||||
|
@ -80,6 +86,7 @@ public class Statemachine implements IStatemachine {
|
|||
state newState = getNewState(input);
|
||||
|
||||
if( newState != currentState ) {
|
||||
lastState = currentState;
|
||||
stateChangeCounter++;
|
||||
currentState = newState;
|
||||
onStateChanged();
|
||||
|
|
|
@ -98,7 +98,10 @@ public class TheGame implements StatemachineListener, GuiEventListener, IRCEvent
|
|||
relaisboard.setRelais(6, true); // enable third green circle
|
||||
|
||||
extraSoundControl.playJingle("jump");
|
||||
//mpdController.playSong("crashtest", "table_game_one");
|
||||
|
||||
if(machine.getLastState() != Statemachine.state.TABLE_GAME_WRONG) {
|
||||
mpdController.playSong("crashtest", "table_game_one");
|
||||
}
|
||||
|
||||
bunti.setLampel(false, true, false);
|
||||
bunti.setPar56(20,0,100);
|
||||
|
@ -247,6 +250,7 @@ public class TheGame implements StatemachineListener, GuiEventListener, IRCEvent
|
|||
mpdController.playSong("crashtest","timeouted");
|
||||
|
||||
if(state == Statemachine.state.ROKET_STARTED) {
|
||||
relaisboard.toggleRelais(0, 300); // r0kets toogle (so there will probably be switched off)
|
||||
ircClient.say("if ready, use >reset");
|
||||
} else {
|
||||
ircClient.say("if ready, set state with >state TABLE_GAME_DONE");
|
||||
|
@ -263,7 +267,7 @@ public class TheGame implements StatemachineListener, GuiEventListener, IRCEvent
|
|||
sayScore();
|
||||
}
|
||||
|
||||
if(tsecondsLeft <= 627 && !startedHurrySound) {
|
||||
if(tsecondsLeft <= 630 && !startedHurrySound) {
|
||||
Statemachine.state state = machine.getCurrentState();
|
||||
if( state != Statemachine.state.TABLE_GAME_DONE &&
|
||||
state != Statemachine.state.ROKET_DONE ) {
|
||||
|
@ -495,10 +499,10 @@ public class TheGame implements StatemachineListener, GuiEventListener, IRCEvent
|
|||
|
||||
private void sayScore() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("stateChangeCounter: ");
|
||||
sb.append("st.ch.: ");
|
||||
sb.append(machine.getStateChangeCounter());
|
||||
|
||||
sb.append(" gamerRating: ");
|
||||
sb.append(" rating: ");
|
||||
sb.append(gamerRating);
|
||||
|
||||
int secondsLeft = machine.getTimerSecondsLeft();
|
||||
|
@ -509,7 +513,7 @@ public class TheGame implements StatemachineListener, GuiEventListener, IRCEvent
|
|||
int minsUsed = secondsUsed / 60;
|
||||
int minsLeft = secondsLeft / 60;
|
||||
|
||||
sb.append(String.format(" time: %d:%02d used: %d:%02d left: %d:%02d",
|
||||
sb.append(String.format(" time:%d:%02d u:%d:%02d l:%d:%02d",
|
||||
mins, seconds % 60, minsUsed, secondsUsed % 60, minsLeft, secondsLeft % 60));
|
||||
|
||||
ircClient.say(sb.toString());
|
||||
|
|
Loading…
Reference in New Issue