Esempio n. 1
0
    public void SaveAllocation()
    {
        AllocationInt.color = Color.white;
        AllocationSpd.color = Color.white;
        AllocationPow.color = Color.white;

        vsacm.AllocatedInt    = _int;
        vsacm.AllocatedPower  = _pow;
        vsacm.AllocatedSpeed  = _spd;
        vsacm.RemainingPoints = _points;

        VSAllCountriesModel.SaveInstance(vsacm);
    }
Esempio n. 2
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}";
    }