/// <summary> /// show or hide the screen /// </summary> public void ChangeSucceedScreenState() { // Yapılacak hata sayısı için üst ve alt limit belirliyorum ve buna göre oranlıyorum. // Aynı şekilde süre içinde. Mantık bu kadar basit. // tableSize * factor -> factor sayesinde ayar yapabiliriz. Duruma göre belki // level sayısınıda faktör olarak ekleriz. float starPercentForTries; float wrongTryUpperLimit = currLevel.totalCardCount * tryUpperLimitMultiplier[((int)currLevel.difficulty) - 1]; float wrongTryLowerLimit = currLevel.totalCardCount * tryLowerLimitMultiplier[((int)currLevel.difficulty) - 1]; starPercentForTries = (wrongTryUpperLimit - wrongTries) / (wrongTryUpperLimit - wrongTryLowerLimit); starPercentForTries = Mathf.Clamp01(starPercentForTries); float starPercentForTime; float passedTimeUpperLimit = currLevel.totalCardCount * timeUpperLimitMultiplier[((int)currLevel.difficulty) - 1]; float passedTimeLowerLimit = currLevel.totalCardCount * timeLowerLimitMultiplier[((int)currLevel.difficulty) - 1]; starPercentForTime = (passedTimeUpperLimit - timePassed) / (passedTimeUpperLimit - passedTimeLowerLimit); starPercentForTime = Mathf.Clamp01(starPercentForTime); float starPercentForBestCount; float bestCountUpperLimit = currLevel.totalCardCount * 1f; float bestCountLowerLimit = currLevel.totalCardCount * 0f; starPercentForBestCount = (nextNumber - bestCountLowerLimit) / (bestCountUpperLimit - bestCountLowerLimit); starPercentForBestCount = Mathf.Clamp01(starPercentForBestCount); if (levelMode == LevelMode.CLASSIC) { starPercent = starPercentForTime * 0.5f + starPercentForTries * 0.5f; } else if (levelMode == LevelMode.DO_NOT_FORGET) { starPercent = starPercentForTries; } else if (levelMode == LevelMode.NO_MISTAKE) { starPercent = starPercentForBestCount; } starPercent = ClampStarPercent(starPercent); int reward = 0; if (starPercent != 0f && ProgressController.IsRewarded(levelMode, levelNo) == false) { if (starPercent <= starPercents[0]) { reward = 1; } else if (starPercent <= starPercents[1]) { reward = 3; } else if (starPercent <= starPercents[2]) { reward = 5; } DataTransfer.remainingTime += reward; } UICont.SetRewardText(reward); SaveProgress(); UICont.ToggleSucceedScreen(); StartCoroutine(UICont.FillStarImage(starPercent)); }