Watch the number of players in the room and dispatch events to tell everyone interested.
Watching for Photon Player connections
This Fsm is a small utility used by the Chat system to know when the room is busy or not. If there is no one in the room, we do not need to show any chat related features.
So, to do that, we simply watch for PHOTON / PHOTON PLAYER CONNECTED and PHOTON / PHOTON PLAYER DISCONNECTED. These events are part of the Playmaker Photon integration
When these events are triggered, this means the number of players in the room has changed, so we query for the number of players on the room, and depending on the result sends a ROOM IS BUSY or ROOM IS EMPTY global event. You'll notice that the state "is there players in the room?" expects least two players to be in, you and at least someone else.
Photon Actions used:
- Photon Network Get Room Properties ( in state "get room players count")