コード例 #1
0
        /// <summary>
        /// A player has entered the room. Ensure the joining player is in sync with the current game state.
        /// </summary>
        /// <param name="player">The Photon Player that entered the room.</param>
        /// <param name="character">The character that the player controls.</param>
        private void OnPlayerEnteredRoom(Player player, GameObject character)
        {
            if (!m_SynchronizeActiveState || m_PhotonView.ViewID == 0 || NetworkObjectPool.SpawnedWithPool(m_GameObject))
            {
                return;
            }

            m_PhotonView.RPC("SetActiveRPC", player, m_GameObject.activeSelf);
        }
コード例 #2
0
        /// <summary>
        /// The object has been enabled.
        /// </summary>
        private void OnEnable()
        {
            m_InitialSync = true;

            // If the object is pooled then the network object pool will manage the active state.
            if (m_SynchronizeActiveState && NetworkObjectPool.SpawnedWithPool(m_GameObject))
            {
                m_SynchronizeActiveState = false;
            }

            if (m_SynchronizeActiveState && m_PhotonView.ViewID != 0 && m_PhotonView.IsMine)
            {
                m_PhotonView.RPC("SetActiveRPC", RpcTarget.Others, true);
            }
        }