Animations are now happening lock-step but I have to add random animations in next_combat for it to work. Need more for each result.
This commit is contained in:
parent
63260f01b9
commit
c6639998ec
9 changed files with 60 additions and 4 deletions
|
|
@ -5,7 +5,8 @@
|
|||
#ifndef FSM_DEBUG
|
||||
#define FSM_STATE(C, S, E, ...) case C::S: S(E, ##__VA_ARGS__); break
|
||||
#else
|
||||
#define FSM_STATE(C, S, E, ...) case C::S: fmt::println(">> " #C " " #S " event={}, state={}", int(E), int($state)); S(E, ##__VA_ARGS__); fmt::println("<< " #C " state={}", int($state)); break
|
||||
int last_event=-1;
|
||||
#define FSM_STATE(C, S, E, ...) case C::S: if(last_event != int(E)) { last_event = int(E); fmt::println(">> " #C " " #S " event={}, state={}", int(E), int($state));}; S(E, ##__VA_ARGS__); break
|
||||
#endif
|
||||
|
||||
template<typename S, typename E>
|
||||
|
|
@ -19,6 +20,9 @@ public:
|
|||
void event(E event, Types... args);
|
||||
|
||||
void state(S next_state) {
|
||||
#ifdef FSM_DEBUG
|
||||
fmt::println("<< STATE: {} -> {}", int($state), int(next_state));
|
||||
#endif
|
||||
$state = next_state;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue