init
This commit is contained in:
commit
78b901484a
323 changed files with 109774 additions and 0 deletions
54
Assets/Scripts/GameOverCanvas.cs
Normal file
54
Assets/Scripts/GameOverCanvas.cs
Normal file
|
@ -0,0 +1,54 @@
|
|||
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<CanvasManager>();
|
||||
if(canvas.difficulty == CanvasManager.CanvasDifficulty.Easy){
|
||||
SceneLoader.instance.LoadScene(1, SceneLoader.DifficultySelected.Easy);
|
||||
}else{
|
||||
SceneLoader.instance.LoadScene(1, SceneLoader.DifficultySelected.Hard);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue