Пример #1
0
    public void RefreshStore()
    {
        NewShop = true;
        PlayerInfoManager.ModifyCredits(-_activePrice);
        float tempPrice = _activePrice * PriceIncrease;

        _activePrice = Mathf.RoundToInt(tempPrice);

        _refreshPriceText.text = _activePrice.ToString("F0") + " Credits";

        _refreshButton.interactable = _activePrice < PlayerInfoManager.Credits;
        GenereteShop();
    }
Пример #2
0
    IEnumerator CompareScore()
    {
        Debug.Log("Compare score");
        string t;
        string s;
        string leftScore  = LeftBoard.PlayerName + "\n\n Score \n" + LeftBoard.ActiveValue + " of " + MaxValue;
        string rightScore = RightBoard.PlayerName + "\n\n Score \n" + RightBoard.ActiveValue + " of " + MaxValue;

        RoundDone = true;
        AiMananger.RoundOver();
        yield return(new WaitForSeconds(0.5f));

        if ((LeftBoard.ActiveValue > RightBoard.ActiveValue && LeftBoard.ActiveValue <= MaxValue) || (LeftBoard.ActiveValue <= MaxValue && RightBoard.ActiveValue > MaxValue)) //left wins
        {
            LeftBoard.Wins++;
            _uiManager.Invoke("UpdateLeftRoundCounter", 1.1f);
            Debug.Log("GameController_script: CompareScore: Player 1(left) Wins");
            SoundManager.PlayEffetDelay(RoundWin, 0.5f);
            if (LeftBoard.Wins == 3) //player wins
            {
                t = "Game Over";
                s = LeftBoard.PlayerName + " Wins";
                _uiManager.ToggleEndScreen(true, false, t, s, leftScore, rightScore);
                _playerInfoManager.GameWon();
                int winnings = Mathf.RoundToInt(AiMananger.AIStates.Odds * _playerInfoManager.BetAmount);
                _playerInfoManager.ModifyCredits(winnings);
                yield break;
            }
            t            = "Round Over";
            s            = LeftBoard.PlayerName + " Wins";
            ActivePlayer = 1;
            _uiManager.ToggleEndScreen(true, true, t, s, leftScore, rightScore);
        }
        else if ((RightBoard.ActiveValue > LeftBoard.ActiveValue && RightBoard.ActiveValue <= MaxValue) || (RightBoard.ActiveValue <= MaxValue && LeftBoard.ActiveValue > MaxValue)) //right wins
        {
            RightBoard.Wins++;
            _uiManager.Invoke("UpdateRightRoundCounter", 1.1f);
            Debug.Log("GameController_script: CompareScore: Player 2(left) Wins");
            SoundManager.PlayEffetDelay(RoundLose, 0.5f);
            if (RightBoard.Wins == 3) //ai wins
            {
                t = "Game Over";
                s = RightBoard.PlayerName + " Wins";
                _uiManager.ToggleEndScreen(true, false, t, s, leftScore, rightScore);
                _playerInfoManager.GameLost();
                _playerInfoManager.ModifyCredits(-_playerInfoManager.BetAmount);
                yield break;
            }
            t            = "Round Over";
            s            = RightBoard.PlayerName + " Wins";
            ActivePlayer = 0;
            _uiManager.ToggleEndScreen(true, true, t, s, leftScore, rightScore);
        }
        else if (LeftBoard.ActiveValue == RightBoard.ActiveValue || (LeftBoard.ActiveValue > MaxValue && RightBoard.ActiveValue > MaxValue)) //draw
        {
            t = "Round Over";
            if (LeftBoard.TieBreaker && !RightBoard.TieBreaker)
            {
                s = "Tie break \n " + LeftBoard.PlayerName + " Wins!";
                LeftBoard.Wins++;
            }
            else if (!LeftBoard.TieBreaker && RightBoard.TieBreaker)
            {
                s = "Tie break \n " + RightBoard.PlayerName + " Wins!";
                RightBoard.Wins++;
            }
            else if (LeftBoard.TieBreaker && RightBoard.TieBreaker)
            {
                s = "Double Tie Break\nDraw";
            }
            else
            {
                s = "Draw";
            }
            _uiManager.ToggleEndScreen(true, true, t, s, leftScore, rightScore);
        }
    }