Merge branch 'master' of git@ooftooft.net:Racesm.git

# Conflicts:
#	Assets/ML-Agents/Timers/WinScreen_timers.json
This commit is contained in:
magn9775
2024-04-26 14:20:58 +02:00
15 changed files with 852 additions and 383 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
@@ -82,8 +83,8 @@ public class GameManager : MonoBehaviour
playerLaps[i] += 1;
if (playerLaps[i] < lapAmount)
lapCounter.text = "Lap count: " + playerLaps[i];
if (playerLaps[i] <= lapAmount)
lapCounter.text = "Lap count: " + playerLaps[i] + "/" + lapAmount;
}
string strTimes =playerTimes[i].ToString();
@@ -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");
}
}
}