Exemplo n.º 1
0
        public void SetValues(GameMetrics gameMetrics)
        {
            for (int i = 0; i < 3; i++)
            {
                stars[i].gameObject.SetActive(i < gameMetrics.GetStars());
            }
            score.text = "" + gameMetrics.GetScore();
//            scorePercentage = (int)(((gameMetrics.GetScore() + 0f) / (MetricsController.GetController().GetMaxScore() + 0f)) * 100);
            correct.text   = "" + gameMetrics.GetRightAnswers();
            incorrect.text = "" + gameMetrics.GetWrongAnswers();
            Invoke("IncrementProgressBar", 0.1f);
            RangeText.text     = gameMetrics.GetRange().ToString();
            BonusTimeText.text = "" + gameMetrics.GetBonusTime();
        }
Exemplo n.º 2
0
 public void SetValues(GameMetrics gameMetrics)
 {
     for (int i = 0; i < 3; i++)
     {
         stars[i].gameObject.SetActive(i < gameMetrics.GetStars());
     }
     score.text = "" + gameMetrics.GetScore();
     scorePercentage = (int)(((gameMetrics.GetScore() + 0f) / (MetricsController.GetController().GetMaxScore() + 0f)) * 100);
     correct.text = "" + gameMetrics.GetRightAnswers();
     incorrect.text = "" + gameMetrics.GetWrongAnswers();
     Invoke("IncrementProgressBar", 0.1f);
     RangeText.text = gameMetrics.GetRange().ToString();
     BonusTimeText.text = "" + gameMetrics.GetBonusTime();
 }
 internal void SetData(GameMetrics playerOneMetrics, GameMetrics playerTwoMetrics, int winner)
 {
     int language = Settings.SettingsController.GetController().GetLanguage();
     if (winner < 1)
     {
         this.winner.text = "";
         this.winnerSentece.text = language == 0 ? "EMPATE" : "DRAW";
     }
     else
     {
         this.winner.text =  (language == 0 ? "JUGADOR " : "PLAYER") + winner;
         this.winnerSentece.text = language == 0 ? "GANADOR" : "WINNER";
     }
     playerOneCorrect.text = "" + playerOneMetrics.GetRightAnswers();
     playerOneWrong.text = "" + playerOneMetrics.GetWrongAnswers();
     playerTwoCorrect.text = "" + playerTwoMetrics.GetRightAnswers();
     playerTwoWrong.text = "" + playerTwoMetrics.GetWrongAnswers();
     this.gameObject.SetActive(true);
     SoundController.GetController().PlayLevelCompleteSound();
 }
Exemplo n.º 4
0
        private void groupGames(List<GameMetrics> metrics)
        {
            int gruopSize = (int)Math.Ceiling((metrics.Count + 0.0f) / (MAX_COLUMNS + 0.0f));
            this.note.text = gruopSize + (SettingsController.GetController().GetLanguage() == 0 ? " en " : " in ") + "1";

            for(int i = 0; i < Math.Ceiling((metrics.Count + 0.0f) / (gruopSize + 0.0f)); i++)
            {
                List<GameMetrics> currentGroup = metrics.GetRange(i * gruopSize, (i * gruopSize + gruopSize) <= metrics.Count ? gruopSize : metrics.Count - metricsPoints.Count * gruopSize);
                GameMetrics currentMetric = new GameMetrics(currentGroup[0].GetArea(), currentGroup[0].GetIndex(), currentGroup[0].GetLevel());
                currentMetric.SetDate(currentGroup[0].GetDate());
                for(int j = 0; j < currentGroup.Count; j++)
                {
                    currentMetric.SetScore(currentMetric.GetScore() + currentGroup[j].GetScore());
                    currentMetric.SetLapsedSeconds(currentMetric.GetLapsedSeconds() + currentGroup[j].GetLapsedSeconds());
                    currentMetric.SetRightAnswers(currentMetric.GetRightAnswers() + currentGroup[j].GetRightAnswers());
                    currentMetric.SetWrongAnswers(currentMetric.GetWrongAnswers() + currentGroup[j].GetWrongAnswers());
                }
                currentMetric.SetScore(Average(currentMetric.GetScore(), currentGroup.Count));
                currentMetric.SetLapsedSeconds(Average(currentMetric.GetLapsedSeconds(), currentGroup.Count));
                currentMetric.SetRightAnswers(Average(currentMetric.GetRightAnswers(), currentGroup.Count));
                currentMetric.SetWrongAnswers(Average(currentMetric.GetWrongAnswers(), currentGroup.Count));

                metricsPoints.Add(currentMetric);
            }
        }
Exemplo n.º 5
0
        private void CalculateFinalScore(GameMetrics gameMetrics, MetricsTable metricsTable)
        {
            for (int i = 0; i < metricsTable.RangeMetricsInfos.Count; i++)
            {
                RangeMetricsInfo currentRangeMetricInfo = metricsTable.RangeMetricsInfos[i];
                if (gameMetrics.GetWrongAnswers() <= currentRangeMetricInfo.MaxErrors &&
                    gameMetrics.GetLapsedSeconds() <= currentRangeMetricInfo.MaxTime)
                {
                    Range range = (Range) (i);
                    float deltaRange = (range.GetDelta() / (currentRangeMetricInfo.MaxErrors - currentRangeMetricInfo.MinErrors + 1));
                    float baseForErrorsQuantity = deltaRange * ( currentRangeMetricInfo.MaxErrors - gameMetrics.GetWrongAnswers());
                    float score = range.GetMinScore() + baseForErrorsQuantity;
                    float bonusFromTime = 0;
                    if (gameMetrics.GetLapsedSeconds() <= currentRangeMetricInfo.MaxTimeToBonus)
                    {
                        float secondsToSubtract = gameMetrics.GetLapsedSeconds() - metricsTable.FreeTime;
                        bonusFromTime = deltaRange;
                        if (secondsToSubtract > 0)
                        {
                            bonusFromTime -= secondsToSubtract*(deltaRange / currentRangeMetricInfo.MaxTimeToBonus);
                        }
                    }
                    score += bonusFromTime;

                    gameMetrics.SetScore(Mathf.RoundToInt(score));
                    gameMetrics.SetBonusTime(Mathf.RoundToInt(bonusFromTime));
                    gameMetrics.SetRange(range);
                    return;
                }
            }

            gameMetrics.SetScore(500);
            gameMetrics.SetBonusTime(0);
            gameMetrics.SetRange(Range.Rookie);
        }
Exemplo n.º 6
0
 private void CalculateFinalScore(GameMetrics gameMetrics, int minSeconds, int pointsPerSecond, int pointsPerError)
 {
     gameMetrics.SetScore(MAX_SCORE - pointsPerSecond * (gameMetrics.GetLapsedSeconds() < minSeconds ? 0 : gameMetrics.GetLapsedSeconds() - minSeconds) - gameMetrics.GetWrongAnswers() * pointsPerError);
     if (gameMetrics.GetScore() < MIN_SCORE) gameMetrics.SetScore(MIN_SCORE);
 }