Let the user select a random room from the one available on the network.
This Fsm helps demonstrating a photon feature; the ability to join a random room amongst the currently existing ones
For this, we need to watch for two built in events, PHOTON / RECEIVED ROOM LIST UPDATE and PHOTON / RECEIVED ROOM LIST. These two events simply tell us that we should check again the number of rooms available and if so present the user with the ability to join one of them randomly.
So, in the "do we have rooms", we query for the number of rooms, and dispatch a YES or NO event, specially created of the occasion. If we do have rooms, we present the user with a button ( we are now in the state "join random room gui" and we tight the button with a GO event specially created for the occasion as well. The random join call can then be made to the Photon system ( state "join random room")
IF, we do not have rooms available, we simply rely on the fact that the Create room Fsm will enable the user to create a room. and we simply show that there is no room available yet ( state "create rooms gui").
Photon Actions used:
- Photon Network Get Rooms Count ( in state "do we have rooms?")
- Photon Network Join Random Room ( in state "join random room")