Gathering in the Room
At the very beginning, someone creates Room. To do this, it is needed to specify the room name and select the level. Also, you could change turn duration, optionally. This information is stored in a RoomEntity instance.
After clicking the Create button, slots for the players will be created from the already configured Players field inside the LevelData asset. Ai slots will be replaced with Player slots, but could be easily reverted to the default values.
Players in the Room could be in two states: Ready or Not ready. Players which are in the Ready state are also stored inside an instance of the RoomEntity class.
When all players are ready, then a MasterClient sends a message to everyone that a game could begin the loading process. Level loading should be synced between all game instances. This logic is reflected in the field Loaded of RoomEntity. When a player loads the level on his side, he sends a message “I have loaded the level” (NetworkController.DoBattleIsLoaded) and waits when the count of loaded players will be equal to the count of all players in the room.
Gathering stage is completed!
Created with the Personal Edition of HelpNDoc: Experience the power of a responsive website for your documentation