Added warning the pops up when the waypoint moves in waypoint race

This commit is contained in:
Gregory Campbell
2020-02-08 20:37:57 -05:00
parent 5a40d1f85d
commit 5241801900
2 changed files with 170 additions and 0 deletions
+12
View File
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using TMPro;
[System.Serializable]
@@ -20,11 +21,13 @@ public class WaypointRace : MonoBehaviour
public Waypoint groundedScript;
public GameObject[] obstacleList;
public GameObject boundaries;
public GameObject WarningText;
private int selection = 0;
RaycastHit hit;
Vector3 lastLocation;
float wanringCountdown;
void Awake()
{
@@ -49,12 +52,18 @@ public class WaypointRace : MonoBehaviour
waypointPlacement();
countdown = Time.time;
completionTime = 60;
WarningText.SetActive(false);
}
void Update()
{
if(wanringCountdown + 5.0f < Time.time)
{
WarningText.SetActive(false);
}
if(script.finished == true)
{
@@ -192,6 +201,9 @@ public class WaypointRace : MonoBehaviour
script.lives = 3;
WarningText.SetActive(true);
wanringCountdown = Time.time;
groundedScript.transform.position = new Vector3(
Random.Range(-100*size, 100*size), Random.Range(2, 10), Random.Range(-100*size, 100*size));