Peer State Machine
A client peer has one of the following states:
- Connected: Initial state after connecting, player has not entered a world.
- WorldEntered: Player entered a world with operation EnterWorld.
- Disconnected: Client disconnected.
This diagram shows all transitions:
The peer uses a different operation handler for each state. This allows operations to behave differently in each state. The following operation handlers are used:
- State Connected: Photon.MmoDemo.Server.MmoPeer
- State WorldEntered: Photon.MmoDemo.Server.MmoActor
- State Disconnected: Photon.SocketServer.Rpc.OperationHandlerDisconnected
The client should always wait for the related operation response event after calling a state changing operation; the peer state and therefore the current operation handler (operation behavior) is not guaranteed until the response event is received. For operation EnterWorld it's the operation response, for operation ExitWorld it's the event WorldExited.