The enabler fsm activate and destroy the various gameObjects managing the various aspects of the scene: the chat, the main menu and the game itself.
This is a critical Fsm.
the scene can find itself into many different situation regards the multi player environment.
- not connected to Photon
- connected to Photon
- not in a room
- in a room
Each of these context call for specific management and different gui content to display to the user.
The connection state is handled in a Menu : connection Fsm, dealing with the contexts at a higher level
Being in a room or not is handled here and when we start, because it's been design in such a way that when the user enters a room, we reload the scene completly and start fresh. So we simply ask the question "are we in a room?"
- if we are, we activate the Game manager object and the chat system, AND we destroy the main menu because it's irrelevant in this context.
- If we are not in a room, we destroy the game manager and thee chat system, AND we active the main menu, Only the menu should be active, so that the user can create or join room.
you'll notice that after we've done the work, we destroy this very gameObject, because we don't need it anymore. So really this Fsm only exists for short time when the scene is loading, activating and destroy what's required and then goes away, because we know that if the context changes the scene will be reloaded.
Photon Actions used:
- Photon Network Get Room Properties ( in state "are we in a room?")