Driving UI 2

This commit is contained in:
2024-04-26 13:07:04 +02:00
parent 2fb03efc2a
commit 2fe54fe26e
6 changed files with 14 additions and 26 deletions

View File

@@ -28,10 +28,9 @@ public class GameManager : MonoBehaviour
playerLaps[i] = 1;
}
for (int i = 0; i < playerTimes.Count(); i++)
for (int i = 0; i < players.Count(); i++)
{
playerTimes[i] = 0;
playerTimesStr[i] = "DNF";
}
DontDestroyOnLoad(gameObject);
@@ -83,7 +82,7 @@ public class GameManager : MonoBehaviour
lapCounter.text = "Lap count: " + playerLaps[i];
}
timeCounter.text = playerTimes[i].ToString();
timeCounter.text = "Time: " + playerTimes[i].ToString();
}
if (playerLaps[i] > lapAmount)
@@ -98,7 +97,6 @@ public class GameManager : MonoBehaviour
player.GetComponent<PlayerController>().enabled = false;
playerTimesStr[i] = playerTimes[i].ToString();
}
}
@@ -106,6 +104,7 @@ public class GameManager : MonoBehaviour
// race finished
if (playersFinished.Count() == players.Count())
{
// if not finished DNF //TODO
SceneManager.LoadScene("WinScreen");
}

View File

@@ -8,7 +8,7 @@ public class WinScript : MonoBehaviour
public TextMeshProUGUI MainText;
public TextMeshProUGUI MainText2;
public List<string> leaderboard;
public List<string> time;
public string[] time;
public GameObject[] Garages;
private GameObject currentGarage;
@@ -20,7 +20,7 @@ public class WinScript : MonoBehaviour
carGarage.SetActive(false);
}
leaderboard = GameObject.Find("GameManager").GetComponent<GameManager>().playersFinished;
time = GameObject.Find("GameManager").GetComponent<GameManager>().playerTimesSTR;
time = GameObject.Find("GameManager").GetComponent<GameManager>().playerTimesStr;
if (leaderboard[0].Contains("Player")){
Garages[0].SetActive(true);
}else{