|
|
@ -52,13 +52,18 @@ class GameEngine : DeadSimpleFSM<GameState, GameEvent> { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void event(GameEvent ev, const char *hit_type) { |
|
|
|
|
|
|
|
string ht{hit_type}; |
|
|
|
|
|
|
|
event(ev, ht); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void event(GameEvent ev) { |
|
|
|
void event(GameEvent ev) { |
|
|
|
switch(_state) { |
|
|
|
switch(_state) { |
|
|
|
FSM_STATE(GameState::START, start, ev); |
|
|
|
FSM_STATE_LOG(GameState, START, start, ev); |
|
|
|
FSM_STATE(GameState::IDLE, idle, ev); |
|
|
|
FSM_STATE_LOG(GameState, IDLE, idle, ev); |
|
|
|
FSM_STATE(GameState::DEAD, dead, ev); |
|
|
|
FSM_STATE_LOG(GameState, DEAD, dead, ev); |
|
|
|
FSM_STATE(GameState::SUCCESS, success, ev); |
|
|
|
FSM_STATE_LOG(GameState, SUCCESS, success, ev); |
|
|
|
FSM_STATE(GameState::FAILURE, failure, ev); |
|
|
|
FSM_STATE_LOG(GameState, FAILURE, failure, ev); |
|
|
|
case GameState::IN_ROUND: { |
|
|
|
case GameState::IN_ROUND: { |
|
|
|
string hit_type = ""; |
|
|
|
string hit_type = ""; |
|
|
|
in_round(ev, hit_type); |
|
|
|
in_round(ev, hit_type); |
|
|
@ -67,7 +72,6 @@ class GameEngine : DeadSimpleFSM<GameState, GameEvent> { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// FSM to replace the others
|
|
|
|
|
|
|
|
void start(GameEvent ev); |
|
|
|
void start(GameEvent ev); |
|
|
|
void idle(GameEvent ev); |
|
|
|
void idle(GameEvent ev); |
|
|
|
void in_round(GameEvent ev, string &hit_type); |
|
|
|
void in_round(GameEvent ev, string &hit_type); |
|
|
@ -75,7 +79,6 @@ class GameEngine : DeadSimpleFSM<GameState, GameEvent> { |
|
|
|
void success(GameEvent ev); |
|
|
|
void success(GameEvent ev); |
|
|
|
void failure(GameEvent ev); |
|
|
|
void failure(GameEvent ev); |
|
|
|
|
|
|
|
|
|
|
|
// current API that will die
|
|
|
|
|
|
|
|
void heal(); |
|
|
|
void heal(); |
|
|
|
bool hit(string &type); |
|
|
|
bool hit(string &type); |
|
|
|
void reset(); |
|
|
|
void reset(); |
|
|
|