Пример #1
0
 // Update is called once per frame
 void Update()
 {
     // if I'm the server, regulate gameplay events.
     if (PhotonNetwork.isMasterClient)
     {
         // if a new state has been assigned by the state machine
         // create and init new state, send message to clients to change states
         if (m_NextStateType != m_CurrentState.GetCurrentStateType())
         {
             //Debug.Log("Server says: Changing state!");
             photonView.RPC("SetGameplayState", PhotonTargets.Others, new object[] { (int)m_NextStateType, PhotonNetwork.time });
             SetGameplayState((int)m_NextStateType, PhotonNetwork.time);
         }
     }
     // update correct state
     m_CurrentState.Update();
 }