Added a few missing UI to help game modes feel more complete and fixed a few game mode bugs

This commit is contained in:
Gregory Campbell
2020-01-19 20:59:20 -05:00
parent a466cf3ab1
commit 6faa075382
7 changed files with 937 additions and 67 deletions
+6 -1
View File
@@ -31,6 +31,7 @@ public class FloorLevel : MonoBehaviour
fullTime = Time.time;
gameOver = false;
script = player.GetComponent<PlayerController>();
level = 1;
escalation = 1;
script.lives = 3;
script.finished = false;
@@ -47,7 +48,11 @@ public class FloorLevel : MonoBehaviour
{
level++;
if(level > 3) escalation++;
if(level > 3)
{
escalation++;
level = 1;
}
respawn();
levelBuild();
+18 -3
View File
@@ -15,6 +15,7 @@ public class PauseMenu : MonoBehaviour
public TextMeshProUGUI ScoreText;
public TextMeshProUGUI TimeText;
public TextMeshProUGUI LivesText;
// Start is called before the first frame update
void Start()
@@ -26,6 +27,20 @@ public class PauseMenu : MonoBehaviour
void Update()
{
if(SceneManager.GetActiveScene().name == "Floor Level")
{
ScoreText.text = "LEVEL: " + FloorLevel.escalation + "-" + FloorLevel.level;
LivesText.text = "LIVES: " + PlayerController.shownLives;
}
if(SceneManager.GetActiveScene().name == "Waypoint Race")
{
ScoreText.text = "LEVEL: " + (WaypointRace.size - 1) + "-" + WaypointRace.level;
TimeText.text = "TIME: " + Mathf.Round((WaypointRace.countdown + WaypointRace.completionTime) - Time.time);
}
if(Input.GetButtonDown("Pause"))
{
if(GameIsPaused)
@@ -73,13 +88,13 @@ public class PauseMenu : MonoBehaviour
if(FloorLevel.gameOver == true)
{
ScoreText.text = "LEVEL: " + FloorLevel.escalation + "-" + FloorLevel.level;
TimeText.text = "TIME: " + FloorLevel.fullTime;
TimeText.text = "TIME: " + Mathf.Round(FloorLevel.fullTime);
}
if(WaypointRace.gameOver == true)
{
ScoreText.text = "LEVEL: " + WaypointRace.size + "-" + WaypointRace.level;
TimeText.text = "TIME: " + WaypointRace.fullTime;
ScoreText.text = "LEVEL: " + (WaypointRace.size - 1) + "-" + WaypointRace.level;
TimeText.text = "TIME: " + Mathf.Round(WaypointRace.fullTime);
}
gameOverUI.SetActive(true);
+4
View File
@@ -16,6 +16,7 @@ public class PlayerController : MonoBehaviour
public bool finished = false;
public bool respawn = false;
public int lives = 3;
public static int shownLives = 3;
public float maxSpeed;
public float acceleration;
public float friction;
@@ -61,6 +62,8 @@ public class PlayerController : MonoBehaviour
maxSpeedStore = maxSpeed;
accelerationStore = acceleration;
shownLives = 3;
Cursor.visible = !Cursor.visible;
Cursor.lockState = CursorLockMode.Locked;
}
@@ -121,6 +124,7 @@ public class PlayerController : MonoBehaviour
respawn = true;
respawnTime = Time.time;
shownLives--;
if (SceneManager.GetActiveScene().name == "Hub World")
{
+12 -4
View File
@@ -12,8 +12,8 @@ public class WaypointRace : MonoBehaviour
public static int size = 1;
public static int level = 1;
public static float fullTime;
public int completionTime = 120;
public float countdown = 0;
public static int completionTime = 120;
public static float countdown = 0;
public GameObject player;
public PlayerController script;
public GameObject waypoint;
@@ -37,12 +37,14 @@ public class WaypointRace : MonoBehaviour
gameOver = false;
script = player.GetComponent<PlayerController>();
size = 2;
level = 1;
script.finished = false;
respawn();
script.pivot.transform.Rotate(0.0f, 225.0f, 0.0f, Space.Self);
levelBuild();
waypointPlacement();
countdown = Time.time;
completionTime = 60;
}
@@ -57,12 +59,12 @@ public class WaypointRace : MonoBehaviour
if(level > 3)
{
size++;
level = 1;
script.respawn = true;
script.respawnTime = Time.time + 0.25f;
countdown = Time.time;
completionTime = 120 * size;
completionTime = 60 * (size - 1);
levelBuild();
level = 1;
}
script.finished = false;
@@ -152,6 +154,12 @@ public class WaypointRace : MonoBehaviour
groundedScript.transform.position = new Vector3(
Random.Range(-100*size, 100*size), Random.Range(2, 10), Random.Range(-100*size, 100*size));
if((groundedScript.transform.position.x < 100 && groundedScript.transform.position.x > -100)
|| (groundedScript.transform.position.z < 100 && groundedScript.transform.position.z > -100))
{
waypointPlacement();
}
}
}