Assets/Main Menu Gradient.asset
This commit is contained in:
@@ -8,8 +8,10 @@ using UnityEngine.SceneManagement;
|
||||
public class FloorLevel : MonoBehaviour
|
||||
{
|
||||
|
||||
public int escalation = 1;
|
||||
public int level = 1;
|
||||
public static bool gameOver = false;
|
||||
public static int escalation = 1;
|
||||
public static int level = 1;
|
||||
public static float fullTime;
|
||||
public GameObject player;
|
||||
public PlayerController script;
|
||||
public GameObject[] obstacleList;
|
||||
@@ -26,7 +28,8 @@ public class FloorLevel : MonoBehaviour
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
fullTime = Time.time;
|
||||
gameOver = false;
|
||||
script = player.GetComponent<PlayerController>();
|
||||
escalation = 1;
|
||||
script.lives = 3;
|
||||
@@ -61,6 +64,9 @@ public class FloorLevel : MonoBehaviour
|
||||
{
|
||||
|
||||
script.lives = -1;
|
||||
PauseMenu.GameIsOver = true;
|
||||
fullTime = Time.time - fullTime;
|
||||
gameOver = true;
|
||||
SceneManager.LoadScene("Hub World", LoadSceneMode.Single);
|
||||
|
||||
}
|
||||
|
||||
@@ -2,13 +2,19 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using TMPro;
|
||||
|
||||
public class PauseMenu : MonoBehaviour
|
||||
{
|
||||
|
||||
public static bool GameIsPaused = false;
|
||||
public static bool GameIsOver = false;
|
||||
|
||||
public GameObject pauseMenuUI;
|
||||
public GameObject gameOverUI;
|
||||
|
||||
public TextMeshProUGUI ScoreText;
|
||||
public TextMeshProUGUI TimeText;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
@@ -34,6 +40,13 @@ public class PauseMenu : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
if(GameIsOver)
|
||||
{
|
||||
GameOver();
|
||||
Cursor.visible = Cursor.visible;
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Resume()
|
||||
@@ -41,6 +54,7 @@ public class PauseMenu : MonoBehaviour
|
||||
pauseMenuUI.SetActive(false);
|
||||
Time.timeScale = 1f;
|
||||
GameIsPaused = false;
|
||||
GameIsOver = false;
|
||||
Cursor.visible = !Cursor.visible;
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
}
|
||||
@@ -54,6 +68,27 @@ public class PauseMenu : MonoBehaviour
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
}
|
||||
|
||||
void GameOver()
|
||||
{
|
||||
if(FloorLevel.gameOver == true)
|
||||
{
|
||||
ScoreText.text = "LEVEL: " + FloorLevel.escalation + "-" + FloorLevel.level;
|
||||
TimeText.text = "TIME: " + FloorLevel.fullTime;
|
||||
}
|
||||
|
||||
if(WaypointRace.gameOver == true)
|
||||
{
|
||||
ScoreText.text = "LEVEL: " + WaypointRace.size + "-" + WaypointRace.level;
|
||||
TimeText.text = "TIME: " + WaypointRace.fullTime;
|
||||
}
|
||||
|
||||
gameOverUI.SetActive(true);
|
||||
Time.timeScale = 0f;
|
||||
GameIsPaused = true;
|
||||
Cursor.visible = Cursor.visible;
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
}
|
||||
|
||||
public void LoadHubWorld()
|
||||
{
|
||||
Time.timeScale = 1f;
|
||||
|
||||
@@ -8,8 +8,10 @@ using UnityEngine.SceneManagement;
|
||||
public class WaypointRace : MonoBehaviour
|
||||
{
|
||||
|
||||
public int size = 1;
|
||||
public int level = 1;
|
||||
public static bool gameOver = false;
|
||||
public static int size = 1;
|
||||
public static int level = 1;
|
||||
public static float fullTime;
|
||||
public int completionTime = 120;
|
||||
public float countdown = 0;
|
||||
public GameObject player;
|
||||
@@ -31,6 +33,8 @@ public class WaypointRace : MonoBehaviour
|
||||
void Start()
|
||||
{
|
||||
|
||||
fullTime = Time.time;
|
||||
gameOver = false;
|
||||
script = player.GetComponent<PlayerController>();
|
||||
size = 2;
|
||||
script.finished = false;
|
||||
@@ -73,6 +77,9 @@ public class WaypointRace : MonoBehaviour
|
||||
if(countdown + completionTime < Time.time)
|
||||
{
|
||||
|
||||
PauseMenu.GameIsOver = true;
|
||||
gameOver = true;
|
||||
fullTime = Time.time - fullTime;
|
||||
SceneManager.LoadScene("Hub World", LoadSceneMode.Single);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user