crawl command fixed
This commit is contained in:
@@ -54,18 +54,15 @@ void render_loop(int speed) {
|
||||
}
|
||||
|
||||
if (uart_event == UartEvent::Triggered) {
|
||||
const char* msg = uart.get_message();
|
||||
PlayerState current = player_state.get_state();
|
||||
|
||||
if (msg && strstr(msg, "crawl2")) {
|
||||
// enter Crawl2 only if currently crawling in crawl1
|
||||
if (current == PlayerState::Crawl1)
|
||||
player_state.start_crawl(PlayerState::Crawl2);
|
||||
// pressing UART trigger while walking/running -> Crawl1
|
||||
if (current == PlayerState::Walk || current == PlayerState::Run) {
|
||||
player_state.start_crawl(PlayerState::Crawl1);
|
||||
}
|
||||
else if (msg && strstr(msg, "crawl")) {
|
||||
// trigger normal crawl from walk/run
|
||||
if (current == PlayerState::Walk || current == PlayerState::Run)
|
||||
player_state.start_crawl(PlayerState::Crawl1);
|
||||
// pressing again while crawling -> Crawl2
|
||||
else if (current == PlayerState::Crawl1) {
|
||||
player_state.start_crawl(PlayerState::Crawl2);
|
||||
}
|
||||
|
||||
need_redraw = true;
|
||||
|
||||
Reference in New Issue
Block a user