private void PlayerSetUp(GameObject playerGameObject, int playerNo)
        {
            group.AddMember(playerGameObject.transform, 1, 0);

            Player player = playerGameObject.GetComponent <Player>();

            player.SetPlayerNo(playerNo);
            player.SetSkin(playerNo);
            players.Add(player);

            // Adding skills to players
            AddBasicSkills(player);
            if (playerNo == 1)
            {
                player.AddSkill(selectedSkills[SkillSelectionController.GetPlayerOneSkill()]);
                playerOneCooldownUi.player = player.GetComponent <Player>();
                var playerOneChargeControllers = playerOneCooldownUi.GetComponentsInChildren <ChargeController>();
                SetCharge(player, playerOneChargeControllers);
                playerOneHealthBar.entity = player.GetComponent <IHealthBar>();
            }
            else
            {
                player.AddSkill(selectedSkills[SkillSelectionController.GetPlayerTwoSkill()]);
                playerTwoCooldownUi.player = player.GetComponent <Player>();
                var playerTwoChargeControllers = playerTwoCooldownUi.GetComponentsInChildren <ChargeController>();
                SetCharge(player, playerTwoChargeControllers);
                playerTwoHealthBar.entity = player.GetComponent <IHealthBar>();
            }
        }
Esempio n. 2
0
 public void OnReadyButtonClicked()
 {
     isReady = !isReady;
     if (isReady)
     {
         skillSelectionController.DisableInput();
         if (PhotonNetwork.IsMasterClient)
         {
             photonView.RPC("OnMasterClientReadyRPC", RpcTarget.All, SkillSelectionController.GetPlayerOneSkill());
         }
         else
         {
             photonView.RPC("OnNonMasterClientReadyRPC", RpcTarget.All, SkillSelectionController.GetPlayerTwoSkill());
         }
         readyButtonText.text = "Ready!";
     }
     else
     {
         skillSelectionController.EnableInput();
         readyButtonText.text = "Ready?";
     }
 }