Created
October 29, 2020 04:45
-
-
Save gltovar/02e9621cf4169b9090b9d437debb1044 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions | |
// - XState (all XState exports) | |
const matchStates = { | |
initial: 'loading_round', | |
states: { | |
loading_round: { | |
on: { | |
ROUND_LOADED: 'playing_round' | |
} | |
}, | |
playing_round: { | |
on: { | |
START_SPECTATING: 'spectating_round', | |
COMPLETE_ROUND: 'round_results', | |
WIN_MATCH: 'won_match', | |
FINISH_MATCH: 'match_summary' | |
} | |
}, | |
spectating_round: { | |
on:{ | |
COMPLETE_ROUND: 'round_results', | |
WIN_MATCH: 'won_match', | |
FINISH_MATCH: 'match_summary' | |
} | |
}, | |
round_results:{ | |
on:{ | |
LOAD_NEXT_ROUND:'loading_round' | |
} | |
}, | |
won_match:{ | |
on:{ | |
FINISH_MATCH: 'match_summary' | |
} | |
}, | |
match_summary:{} | |
} | |
}; | |
const fallGuysMachine = Machine({ | |
key: 'fall_guys', | |
initial: 'main_menu', | |
states: { | |
main_menu: { | |
on: { | |
START_SEARCH: 'match_search' | |
} | |
}, | |
match_search: { | |
on: { | |
MATCH_FOUND: 'playing_match' | |
} | |
}, | |
playing_match: { | |
on: { | |
LEAVE_MATCH: 'main_menu' | |
}, | |
...matchStates | |
} | |
}, | |
on: { | |
// POWER_OUTAGE: '.red.blinking', | |
// POWER_RESTORED: '.red' | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment