예제 #1
0
    private void OnFinish()
    {
        if (state == 3)
        {
            return;
        }
        else
        {
            int logs = isPlayer1 ? GameCanvas.GetPlayer1Logs() : GameCanvas.GetPlayer2Logs();

            if (logs >= buildCosts[state])
            {
                spamKeyMinigame.currentValue = 0.5f;

                if (isPlayer1)
                {
                    GameCanvas.SetPlayer1Logs(logs - buildCosts[state]);
                }
                else
                {
                    GameCanvas.SetPlayer2Logs(logs - buildCosts[state]);
                }

                state++;

                if (state == 3)
                {
                    buildCostObject.SetActive(false);
                    photonView.RPC("EnableSpamKey", RpcTarget.Others, true, 0, false);

                    if (OnMaximum != null)
                    {
                        OnMaximum.Invoke();
                    }

                    if (isPlayer1)
                    {
                        LeftSide.AddNewDamBeaver();
                    }
                    else
                    {
                        RightSide.AddNewDamBeaver();
                    }
                }
                else
                {
                    photonView.RPC("EnableSpamKey", RpcTarget.Others, true, buildCosts[state], true);
                }

                buildCostText.text = buildCosts[state].ToString();


                AudioSFXReferences.PlayPurchase();
            }
        }
    }