Exemple #1
0
    public void BuyCharacter()
    {
        int currentPoints = PointsUtil.GetCurrentPoints();
        var country       = countries[PlayerSelectedIndex];

        if (currentPoints >= country.UnlockCost)
        {
            Debug.Log("COUNTRY BOUGHT");
            country.IsLocked = false;
            PointsUtil.AddPoints(-country.UnlockCost);

            PointsObject.UpdatePoints();
            RefreshSelection();
            CountryModel.OverwriteCountries(countries);
        }
        else
        {
            Debug.Log("NOT ENOUGH POINTS");
        }
    }
Exemple #2
0
 public void Reduce25Points()
 {
     PointsUtil.AddPoints(-25);
     PointsDisplay.UpdatePoints();
 }
Exemple #3
0
    public void AddScore(int teamIndex)
    {
        var sd = GameObject.FindObjectsOfType <SuperKickDestination>();

        foreach (var i in sd)
        {
            Destroy(i.gameObject);
        }

        if (SelectionSingleton.instance.IsPractice)
        {
            return;
        }

        TeamProps t  = teams[teamIndex];
        TeamProps to = teams[(teamIndex == 0) ? 1 : 0];
        string    sr = "ROUND";

        t.Score       += 1;
        t.UIScore.text = t.Score.ToString();
        string c = (teamIndex == 0) ? "red" : "blue";

        if ((t.Score + to.Score) % 3 == 0)
        {
            isTopServe = !isTopServe;
        }

        if (t.Score >= currentScoreToWin && t.Score - to.Score > 1)
        {
            currentSet++;

            sr                = "SET";
            t.SetCore        += 1;
            t.UISetScore.text = t.SetCore.ToString();
            t.Score           = 0;
            t.UIScore.text    = t.Score.ToString();
            to.Score          = 0;
            to.UIScore.text   = t.Score.ToString();


            if (currentSet == FINAL_SET)
            {
                Debug.Log("FINAL SET");
                currentScoreToWin = SCORE_TO_WIN_LAST_SET;
            }
        }

        if (t.SetCore == SETS_TO_WIN)
        {
            MatchFinishedPanel.SetActive(true);
            hasWinner = true;
            sr        = "MATCH";

            if (teamIndex == 1)
            {
                if (!SelectionSingleton.instance.IsMinigame)
                {
                    TextEndGame.text = "You've earned <color=\"yellow\">100</color> points";
                    EarnedPointsUI.SetActive(true);
                    PointsUtil.AddPoints(100);
                }
                else
                {
                    TextEndGame.text = "You've earned <color=\"yellow\">5</color> allocation points";
                    EarnedPointsUI.SetActive(true);
                    var vsac = VSAllCountriesModel.GetCurrentGame();
                    vsac.RemainingPoints += 5;
                    vsac.CurrentLevel     = vsac.CurrentLevel < 4 ? vsac.CurrentLevel + 1 : 0;
                    VSAllCountriesModel.SaveInstance(vsac);
                    //PointsUtil.AddPoints(100);
                }
            }
        }

        ScoredTeamText.text = $"<color={c}>{t.TeamName}</color> WIN {sr}";
    }
Exemple #4
0
 public void Add25Points()
 {
     PointsUtil.AddPoints(25);
     PointsDisplay.UpdatePoints();
 }