void AddWaitingPlayer(NetPlayerState netPlayerState) { NetPlayer netPlayer = netPlayerState.netPlayer; netPlayer.RemoveAllHandlers(); netPlayer.OnDisconnect += RemoveNetPlayer; m_waitingPlayers.Add(netPlayerState); // Execute WaitingNetPlayer on the GameObject using this class. In otherwords // the game object with the PlayerConnector or PlayerSpawer script component SendSpawnInfoToGameObject("WaitingNetPlayer", m_gameObject, netPlayerState, SendMessageOptions.DontRequireReceiver); }
void StartActivePlayer(GameObject gameObject, PlayerState playerState, NetPlayerState netPlayerState) { m_activePlayers.Add(netPlayerState); NetPlayer netPlayer = netPlayerState.netPlayer; netPlayer.RemoveAllHandlers(); netPlayer.OnDisconnect += RemoveNetPlayer; playerState.netPlayer = netPlayer; playerState.id = netPlayer.GetSessionId(); SendSpawnInfoToGameObject("InitializeNetPlayer", gameObject, netPlayerState); }