private void Update() { if (photonView.IsMine) { if (Input.GetKeyDown(keyCode) && !_isBought) { int fishs = isPlayer1 ? GameCanvas.GetPlayer1Fish() : GameCanvas.GetPlayer2Fish(); int beavers = isPlayer1 ? GameCanvas.GetPlayer1Beavers() : GameCanvas.GetPlayer2Beavers(); if (Input.GetKeyDown(keyCode) && (fishs >= buildCost) && (beavers >= 1)) { if (isPlayer1) { GameCanvas.SetPlayer1Fish(fishs - buildCost); GameCanvas.SetPlayer1Beavers(beavers - 1); } else { GameCanvas.SetPlayer2Fish(fishs - buildCost); GameCanvas.SetPlayer2Beavers(beavers - 1); } spamKeyMinigame.currentValue = 0.0f; spamKeyBold.SetActive(true); buildCostObject.SetActive(false); photonView.RPC("OnBought", RpcTarget.Others); _isBought = true; AudioSFXReferences.PlayPurchase(); if (isPlayer1) { LeftSide.AddNewWoodBeaver(); } else { RightSide.AddNewWoodBeaver(); } } } } }