Changed infinity runner so score is based on level and distance instead of level and time

This commit is contained in:
Gregory Campbell
2020-02-08 13:04:24 -05:00
parent 6f5d6568c8
commit d60e1743f0
5 changed files with 170 additions and 6 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ public class HighScore : MonoBehaviour
InfinityScoreText.text = "HIGH SCORE: " + "\n" + PlayerPrefs.GetInt("RunnerHighFloor")
+ "-" + PlayerPrefs.GetInt("RunnerHighLevel");
InfinityTimeText.text = "HIGH SCORE TIME: " + "\n" + Mathf.Round(PlayerPrefs.GetFloat("RunnerHighTime"));
InfinityTimeText.text = "HIGH SCORE DISTANCE: " + "\n" + Mathf.Round(PlayerPrefs.GetFloat("RunnerHighDistance"));
}
}
+3
View File
@@ -12,6 +12,7 @@ public class InfinityRunner : MonoBehaviour
public static int escalation = 1;
public static int level = 1;
public static float fullTime;
public static float distance;
public GameObject player;
public PlayerController script;
public GameObject[] obstacleList;
@@ -51,6 +52,8 @@ public class InfinityRunner : MonoBehaviour
void Update()
{
distance = player.transform.position.z;
if(spawnTime + countdownTime < Time.time)
{
+6 -4
View File
@@ -17,6 +17,7 @@ public class PauseMenu : MonoBehaviour
public TextMeshProUGUI ScoreText;
public TextMeshProUGUI TimeText;
public TextMeshProUGUI LivesText;
public TextMeshProUGUI MiddleText;
public TextMeshProUGUI HighScoreText;
public TextMeshProUGUI HighTimeText;
@@ -50,6 +51,7 @@ public class PauseMenu : MonoBehaviour
{
ScoreText.text = "LEVEL: " + InfinityRunner.escalation + "-" + InfinityRunner.level;
LivesText.text = "LIVES: " + PlayerController.shownLives;
MiddleText.text = "DISTANCE: " + Mathf.Round(InfinityRunner.distance);
}
if(Input.GetButtonDown("Pause"))
@@ -188,7 +190,7 @@ public class PauseMenu : MonoBehaviour
if(InfinityRunner.gameOver == true)
{
ScoreText.text = "LEVEL: " + InfinityRunner.escalation + "-" + InfinityRunner.level;
TimeText.text = "TIME: " + Mathf.Round(InfinityRunner.fullTime);
TimeText.text = "DISTANCE: " + Mathf.Round(InfinityRunner.distance);
if(InfinityRunner.escalation > PlayerPrefs.GetInt("RunnerHighFloor") ||
(InfinityRunner.escalation == PlayerPrefs.GetInt("RunnerHighFloor") &&
@@ -198,11 +200,11 @@ public class PauseMenu : MonoBehaviour
if(InfinityRunner.escalation > PlayerPrefs.GetInt("RunnerHighFloor") ||
InfinityRunner.level > PlayerPrefs.GetInt("RunnerHighLevel") ||
(InfinityRunner.level == PlayerPrefs.GetInt("RunnerHighLevel") &&
Mathf.Round(InfinityRunner.fullTime) < PlayerPrefs.GetFloat("RunnerHighTime")))
Mathf.Round(InfinityRunner.distance) > PlayerPrefs.GetFloat("RunnerHighDistance")))
{
PlayerPrefs.SetInt("RunnerHighFloor", InfinityRunner.escalation);
PlayerPrefs.SetInt("RunnerHighLevel", InfinityRunner.level);
PlayerPrefs.SetFloat("RunnerHighTime", Mathf.Round(InfinityRunner.fullTime));
PlayerPrefs.SetFloat("RunnerHighDistance", Mathf.Round(InfinityRunner.distance));
highscore = true;
}
@@ -218,7 +220,7 @@ public class PauseMenu : MonoBehaviour
HighScoreText.text = "HIGH SCORE: " + PlayerPrefs.GetInt("RunnerHighFloor")
+ "-" + PlayerPrefs.GetInt("RunnerHighLevel");
HighTimeText.text = "HIGH SCORE TIME: " + Mathf.Round(PlayerPrefs.GetFloat("RunnerHighTime"));
HighTimeText.text = "HIGH SCORE DISTANCE: " + Mathf.Round(PlayerPrefs.GetFloat("RunnerHighDistance"));
}
}