/// <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); if (ProgressController.IsRecordExist(levelMode, levelNo) == false) { if (starPercent <= starPercents[0]) { DataTransfer.remainingTime += 1f; } else if (starPercent <= starPercents[1]) { DataTransfer.remainingTime += 3f; } else if (starPercent <= starPercents[2]) { DataTransfer.remainingTime += 5f; } } SaveProgress(); UICont.ToggleSucceedScreen(); StartCoroutine(UICont.FillStarImage(starPercent)); }