コード例 #1
0
 protected override void ResetGame()
 {
     InputBridgeBase.ToggleMovement(false);
     CustomPlayerProperties.ResetProps(PhotonNetwork.LocalPlayer);
     if (PhotonNetwork.IsMasterClient)
     {
         CustomRoomProperties.InitializeRoom(PhotonNetwork.CurrentRoom, PhotonNetwork.CurrentRoom.PlayerCount);
     }
 }
コード例 #2
0
 private void RPCRespawn()
 {
     if (!view.IsMine)
     {
         //StartCoroutine(EnableAvatar());
         avatar.SetActive(true);
     }
     else
     {
         InputBridgeBase.ToggleMovement(true);
     }
 }
コード例 #3
0
 private void RPCDespawn()
 {
     if (!view.IsMine)
     {
         avatar.SetActive(false);
         thisTransform.localPosition = Vector3.zero;
         //thisObject.SetActive(false);
     }
     else
     {
         InputBridgeBase.ToggleMovement(false);
         thisTransform.localPosition = Vector3.zero;
         respawnEvent.Raise();
     }
 }
コード例 #4
0
    public override void OnRoomPropertiesUpdate(Hashtable propertiesThatChanged)
    {
        // this will update when the game state changes
        if (propertiesThatChanged.ContainsKey(CustomRoomProperties.game))
        {
            int newstate = (int)propertiesThatChanged[CustomRoomProperties.game];
            if (newstate == 1 && PhotonNetwork.IsMasterClient)
            {
                GameMode.instance.SetupAvatars();
                GameMode.instance.StartGame();
            }
            else if (newstate == 2)
            {
                InputBridgeBase.ToggleMovement(true);
                uiMessage.Value = "Start!";
            }
            else if (newstate == 3)
            {
                InputBridgeBase.ToggleMovement(false);
                GameMode.instance.EndGame();
            }
        }

        // this will update when a player scores
        if (propertiesThatChanged.ContainsKey(CustomRoomProperties.scores) && GameMode.instance.IsGameActive)
        {
            GameMode.instance.CheckGame();
        }

        // this will update when the interest in a team is updated
        // ie when a team wins
        if (propertiesThatChanged.ContainsKey(CustomRoomProperties.interest) && GameMode.instance.IsGameActive)
        {
            if (!GameMode.instance.IsGameActive)
            {
                return;
            }
            var index = (int)propertiesThatChanged[CustomRoomProperties.interest];
            if (index == -1)
            {
                return;
            }
            var team = GameMode.instance.Teams[index].teamName;
            uiMessage.Value = $"{team} won!";
        }
    }