Fixed bug that would have game over screen stuck on a specific game mode

This commit is contained in:
Gregory Campbell
2020-02-08 23:17:27 -05:00
parent d31d28d8e3
commit 9f5abc9267
2 changed files with 34 additions and 18 deletions
+16 -18
View File
@@ -151,7 +151,8 @@ public class PauseMenu : MonoBehaviour
HighScoreText.text = "HIGH SCORE: " + PlayerPrefs.GetInt("ObstacleHighFloor") HighScoreText.text = "HIGH SCORE: " + PlayerPrefs.GetInt("ObstacleHighFloor")
+ "-" + PlayerPrefs.GetInt("ObstacleHighLevel"); + "-" + PlayerPrefs.GetInt("ObstacleHighLevel");
HighTimeText.text = "HIGH SCORE TIME: " + Mathf.Round(PlayerPrefs.GetFloat("ObstacleHighTime")); HighTimeText.text = "HIGH SCORE TIME: " + Mathf.Round(PlayerPrefs.GetFloat("ObstacleHighTime"));
} else if(WaypointRace.gameOver == true) }
if(WaypointRace.gameOver == true)
{ {
ScoreText.text = "LEVEL: " + (WaypointRace.size - 1) + "-" + WaypointRace.level; ScoreText.text = "LEVEL: " + (WaypointRace.size - 1) + "-" + WaypointRace.level;
TimeText.text = "TIME: " + Mathf.Round(WaypointRace.fullTime); TimeText.text = "TIME: " + Mathf.Round(WaypointRace.fullTime);
@@ -186,7 +187,8 @@ public class PauseMenu : MonoBehaviour
+ "-" + PlayerPrefs.GetInt("WaypointHighFloor"); + "-" + PlayerPrefs.GetInt("WaypointHighFloor");
HighTimeText.text = "HIGH SCORE TIME: " + Mathf.Round(PlayerPrefs.GetFloat("WaypointHighTime")); HighTimeText.text = "HIGH SCORE TIME: " + Mathf.Round(PlayerPrefs.GetFloat("WaypointHighTime"));
} else if(InfinityRunner.gameOver == true) }
if(InfinityRunner.gameOver == true)
{ {
ScoreText.text = "LEVEL: " + InfinityRunner.escalation + "-" + InfinityRunner.level; ScoreText.text = "LEVEL: " + InfinityRunner.escalation + "-" + InfinityRunner.level;
TimeText.text = "TIME: " + Mathf.Round(InfinityRunner.fullTime); TimeText.text = "TIME: " + Mathf.Round(InfinityRunner.fullTime);
@@ -226,14 +228,14 @@ public class PauseMenu : MonoBehaviour
public void LoadHubWorld() public void LoadHubWorld()
{ {
Time.timeScale = 1f; FloorLevel.gameOver = false;
GameIsPaused = false;
SceneManager.LoadScene("Hub World", LoadSceneMode.Single);
Cursor.visible = false;
Cursor.lockState = CursorLockMode.Locked;
FloorLevel.gameOver = false;
WaypointRace.gameOver = false; WaypointRace.gameOver = false;
InfinityRunner.gameOver = false; InfinityRunner.gameOver = false;
Time.timeScale = 1f;
GameIsPaused = false;
Cursor.visible = false;
Cursor.lockState = CursorLockMode.Locked;
SceneManager.LoadScene("Hub World", LoadSceneMode.Single);
} }
public void LoadMenu() public void LoadMenu()
@@ -255,20 +257,16 @@ public class PauseMenu : MonoBehaviour
if(FloorLevel.gameOver == true) if(FloorLevel.gameOver == true)
{ {
FloorLevel.gameOver = false; FloorLevel.gameOver = false;
WaypointRace.gameOver = false;
InfinityRunner.gameOver = false;
SceneManager.LoadScene("Floor Level", LoadSceneMode.Single); SceneManager.LoadScene("Floor Level", LoadSceneMode.Single);
} else if(WaypointRace.gameOver == true) }
if(WaypointRace.gameOver == true)
{ {
FloorLevel.gameOver = false; WaypointRace.gameOver = false;
WaypointRace.gameOver = false;
InfinityRunner.gameOver = false;
SceneManager.LoadScene("Waypoint Race", LoadSceneMode.Single); SceneManager.LoadScene("Waypoint Race", LoadSceneMode.Single);
} else if(InfinityRunner.gameOver == true) }
if(InfinityRunner.gameOver == true)
{ {
FloorLevel.gameOver = false; InfinityRunner.gameOver = false;
WaypointRace.gameOver = false;
InfinityRunner.gameOver = false;
SceneManager.LoadScene("Infinity Runner", LoadSceneMode.Single); SceneManager.LoadScene("Infinity Runner", LoadSceneMode.Single);
} }
+18
View File
@@ -101,23 +101,41 @@ public class PlayerController : MonoBehaviour
if(hit.gameObject.tag == "Obstacle Portal") if(hit.gameObject.tag == "Obstacle Portal")
{ {
FloorLevel.gameOver = false;
WaypointRace.gameOver = false;
InfinityRunner.gameOver = false;
SceneManager.LoadScene("Floor Level", LoadSceneMode.Single); SceneManager.LoadScene("Floor Level", LoadSceneMode.Single);
respawnTime = Time.time; respawnTime = Time.time;
respawnNoise.Play(); respawnNoise.Play();
FloorLevel.gameOver = false;
WaypointRace.gameOver = false;
InfinityRunner.gameOver = false;
} }
if(hit.gameObject.tag == "Waypoint Portal") if(hit.gameObject.tag == "Waypoint Portal")
{ {
FloorLevel.gameOver = false;
WaypointRace.gameOver = false;
InfinityRunner.gameOver = false;
SceneManager.LoadScene("Waypoint Race", LoadSceneMode.Single); SceneManager.LoadScene("Waypoint Race", LoadSceneMode.Single);
respawnTime = Time.time; respawnTime = Time.time;
respawnNoise.Play(); respawnNoise.Play();
FloorLevel.gameOver = false;
WaypointRace.gameOver = false;
InfinityRunner.gameOver = false;
} }
if(hit.gameObject.tag == "Infinite Portal") if(hit.gameObject.tag == "Infinite Portal")
{ {
FloorLevel.gameOver = false;
WaypointRace.gameOver = false;
InfinityRunner.gameOver = false;
SceneManager.LoadScene("Infinity Runner", LoadSceneMode.Single); SceneManager.LoadScene("Infinity Runner", LoadSceneMode.Single);
respawnTime = Time.time; respawnTime = Time.time;
respawnNoise.Play(); respawnNoise.Play();
FloorLevel.gameOver = false;
WaypointRace.gameOver = false;
InfinityRunner.gameOver = false;
} }
} }