Пример #1
0
    public void Reset()
    {
        enemiesKilledOk    = 0;
        enemiesKilledWrong = 0;

        currentIncrement   = 0;
        chainRemainingTime = 0f;
        currentChain       = 0;
        maxChain           = 0;

        colorAccuracy = 0;
        finalScore    = 0;
        finalGrade    = StatsGrade.C;

        currentLevelStats = null;
    }
Пример #2
0
    public void ComputeScore(int totalTime)
    {
        if (currentLevelStats == null)
        {
            return;
        }


        if (enemiesKilledOk + enemiesKilledWrong > 0)
        {
            colorAccuracy = Mathf.RoundToInt((float)enemiesKilledOk / (float)(enemiesKilledOk + enemiesKilledWrong) * 100);
        }
        else
        {
            colorAccuracy = 0;
        }

        //Chain * multiplier
        if (rsc.gameInfo.numberOfPlayers == 1)
        {
            finalScore = maxChain * currentLevelStats.maxChain1PlayerMultiplier;
        }
        else
        {
            finalScore = maxChain * currentLevelStats.maxChain2PlayersMultiplier;
        }

        //Accuracy factor
        finalScore = finalScore / 100 * colorAccuracy;

        //Time score
        int timeScore = ((rsc.gameInfo.numberOfPlayers == 1 ? currentLevelStats.baseSeconds1Player : currentLevelStats.baseSeconds2Players) - totalTime) * currentLevelStats.secondMultiplier;

        if (timeScore < 0)
        {
            timeScore /= 10;
        }

        finalScore += timeScore;

        if (finalScore < 0)
        {
            finalScore = 0;
        }

        //Grade
        if (finalScore >= currentLevelStats.sGradeMinPoints)
        {
            finalGrade = StatsGrade.S;
        }
        else if (finalScore >= currentLevelStats.aGradeMinPoints)
        {
            finalGrade = StatsGrade.A;
        }
        else if (finalScore >= currentLevelStats.bGradeMinPoints)
        {
            finalGrade = StatsGrade.B;
        }
        else
        {
            finalGrade = StatsGrade.C;
        }
    }