-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStateManager.pde
38 lines (32 loc) · 897 Bytes
/
StateManager.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
class StateManager
{
final static int STATE_MENU = 0;
final static int STATE_DUNGEON = 1;
final static int STATE_ENDING = 2;
State currentState = null;
State nextState = null;
boolean transitioning = false;
int transitionAlpha = 0;
void switchState( int newState, boolean useTransition )
{
switch( newState )
{
case STATE_MENU:
nextState = new MenuState();
break;
case STATE_DUNGEON:
nextState = new DungeonState();
break;
case STATE_ENDING:
nextState = new EndingState();
break;
}
nextState.init();
transitioning = useTransition;
if ( !useTransition )
{
currentState = nextState;
return;
}
}
}