Funduk
Code no working
using TMPro;
using UnityEditor.Experimental.GraphView;
using UnityEngine;
using UnityEngine.UIElements;
public class LoseWindow : MonoBehaviour
{
public TextMeshProUGUI scoreText;
public TextMeshProUGUI bestScoreTXT;
public Medal[] medals;
public Image medalDisplay;
public void PlayerLose()
{
int score = ScoreManager.Instance.score;
scoreText.text = score.ToString();
int bestScore = PlayerPrefs.GetInt(key:"BestScore");
if (score > bestScore)
{
bestScore = score;
}
for (int i = 0; i < medals.Length; i++)
{
if (medals[i].SporeNeed <= score)
{
if (i > 0)
{
medalDisplay.gameObject.SetActive(true);
medalDisplay.sprite = medals[i].MedalSprite;
}
else break;
}
}
bestScoreTXT.text = bestScore.ToString();
PlayerPrefs.SetInt("BestScore", bestScore);
} }
} }
5 replies