using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; public class GameOverCanvas : MonoBehaviour{ [SerializeField] TextMeshProUGUI newRecordText; [Space] public int movementsDone; [SerializeField] TextMeshProUGUI movementDonePoints; [Space] public int enemiesKilled; [SerializeField] TextMeshProUGUI enemiesKilledPoints; [Space] [SerializeField] int totalPoints; [SerializeField] TextMeshProUGUI totalPointsPoints; // Start is called before the first frame update void Start(){ totalPoints = (movementsDone / 3) * enemiesKilled; totalPointsPoints.text = totalPoints.ToString(); movementDonePoints.text = movementsDone.ToString(); enemiesKilledPoints.text = enemiesKilled.ToString(); if (PlayerPrefs.HasKey("MaxScore")){ if(PlayerPrefs.GetInt("MaxScore") < totalPoints){ newRecordText.enabled = true; PlayerPrefs.SetInt("MaxScore", totalPoints); }else{ newRecordText.enabled = false; } }else{ newRecordText.enabled = true; PlayerPrefs.SetInt("MaxScore", totalPoints); } } public void Menu(){ SceneLoader.instance.LoadScene(0, SceneLoader.DifficultySelected.Easy); } public void Retry(){ CanvasManager canvas = FindObjectOfType(); if(canvas.difficulty == CanvasManager.CanvasDifficulty.Easy){ SceneLoader.instance.LoadScene(1, SceneLoader.DifficultySelected.Easy); }else{ SceneLoader.instance.LoadScene(1, SceneLoader.DifficultySelected.Hard); } } }