Feature/json
# Conflicts: # control/GameStateManager.java # image/Images.java # main/Window.java # model/gameState/MenuState.java
This commit is contained in:
@@ -3,9 +3,11 @@ package control;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import model.SongHandler;
|
||||
import model.gameState.GameState;
|
||||
import model.gameState.MenuState;
|
||||
import model.gameState.TitleState;
|
||||
import model.gameState.PickSongState;
|
||||
import model.gameState.PlayState;
|
||||
|
||||
public class GameStateManager {
|
||||
@@ -14,18 +16,33 @@ public class GameStateManager {
|
||||
public GameState currentState;
|
||||
private int index = 0;
|
||||
|
||||
public GameStateManager(){
|
||||
public enum State {
|
||||
TITLE_STATE,
|
||||
MENU_STATE,
|
||||
PLAY_STATE,
|
||||
PICKSONG_STATE
|
||||
}
|
||||
|
||||
public GameStateManager(SongHandler sh){
|
||||
gamestates = new ArrayList<GameState>();
|
||||
gamestates.add(new TitleState(this));
|
||||
gamestates.add(new MenuState(this));
|
||||
gamestates.add(new PlayState(this));
|
||||
gamestates.add(new TitleState(this, sh));
|
||||
gamestates.add(new MenuState(this, sh));
|
||||
gamestates.add(new PlayState(this, sh));
|
||||
gamestates.add(new PickSongState(this, sh));
|
||||
currentState = gamestates.get(0);
|
||||
}
|
||||
|
||||
public void setState(State st)
|
||||
{
|
||||
currentState = gamestates.get(st.ordinal());
|
||||
currentState.init();
|
||||
}
|
||||
|
||||
public void next() {
|
||||
index++;
|
||||
index %= gamestates.size();
|
||||
currentState = gamestates.get(index);
|
||||
currentState.init();
|
||||
}
|
||||
|
||||
public void update(){
|
||||
|
||||
Reference in New Issue
Block a user