win music

This commit is contained in:
2024-04-26 14:16:04 +02:00
parent fdf4c1033d
commit a17999b57f
5 changed files with 229 additions and 2 deletions

View File

@@ -18,6 +18,7 @@ public class GameManager : MonoBehaviour
int[] playerLaps;
public TextMeshProUGUI lapCounter;
public TextMeshProUGUI timeCounter;
float DNFTimer = 0;
void Start()
{
// reset laps
@@ -115,9 +116,14 @@ public class GameManager : MonoBehaviour
}
}
//DNF
if (playersFinished.Count() > 0)
{
DNFTimer += Time.deltaTime;
}
// race finished
if (playersFinished.Count() == players.Count())
if (playersFinished.Count() == players.Count() || DNFTimer > 10)
{
// sort array
float[] fTimes = new float[players.Count()];
@@ -145,5 +151,7 @@ public class GameManager : MonoBehaviour
SceneManager.LoadScene("WinScreen");
}
}
}