timer thing probably works
This commit is contained in:
@@ -1 +1 @@
|
||||
{"count":1,"self":14.5199792,"total":14.604305799999999,"children":{"InitializeActuators":{"count":8,"self":0.0010126,"total":0.0010126,"children":null},"InitializeSensors":{"count":8,"self":0.001,"total":0.001,"children":null},"AgentSendState":{"count":6,"self":0.0035098,"total":0.0170553,"children":{"CollectObservations":{"count":16,"self":0.0020025999999999998,"total":0.0020025999999999998,"children":null},"WriteActionMask":{"count":16,"self":0,"total":0,"children":null},"RequestDecision":{"count":16,"self":0.0115429,"total":0.0115429,"children":null}}},"DecideAction":{"count":6,"self":0.0632583,"total":0.0632583,"children":{"RayPerceptionSensor.Perceive":{"count":32,"self":0,"total":0,"children":null}}},"AgentAct":{"count":6,"self":0.0010003,"total":0.0010003,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1714129274","unity_version":"2022.3.11f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2022.3.11f1\\Editor\\Unity.exe -projectpath C:\\Users\\noahk\\Documents\\Unity projects\\Racesm -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-noahk -hubSessionId a6f45e0e-41b6-4c96-a70e-ec8e10ca5aa9 -accessToken LhF-MiZYoHmiI2p1_6JvQZvJ6QUPd4VyLbrTbhNHTT8005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"ForestRacetrack","end_time_seconds":"1714129288"}}
|
||||
{"count":1,"self":8.7055952,"total":8.8210854,"children":{"InitializeActuators":{"count":8,"self":0.0010003,"total":0.0010003,"children":null},"InitializeSensors":{"count":8,"self":0.0035110999999999996,"total":0.0035110999999999996,"children":null},"AgentSendState":{"count":44,"self":0.0055582,"total":0.018727499999999998,"children":{"CollectObservations":{"count":72,"self":0.0019789,"total":0.0019789,"children":null},"WriteActionMask":{"count":72,"self":0,"total":0,"children":null},"RequestDecision":{"count":72,"self":0.0111904,"total":0.0111904,"children":null}}},"DecideAction":{"count":44,"self":0.0842009,"total":0.0842009,"children":{"RayPerceptionSensor.Perceive":{"count":144,"self":0,"total":0,"children":null}}},"AgentAct":{"count":44,"self":0.0080505,"total":0.0080505,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1714129909","unity_version":"2022.3.11f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2022.3.11f1\\Editor\\Unity.exe -projectpath C:\\Users\\noahk\\Documents\\Unity projects\\Racesm -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-noahk -hubSessionId a6f45e0e-41b6-4c96-a70e-ec8e10ca5aa9 -accessToken LhF-MiZYoHmiI2p1_6JvQZvJ6QUPd4VyLbrTbhNHTT8005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"ForestRacetrack","end_time_seconds":"1714129918"}}
|
||||
@@ -6171,7 +6171,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 1373860105}
|
||||
- target: {fileID: 5365138393421743302, guid: dc3e6243ce610df4c845a9fa5df754a7, type: 3}
|
||||
propertyPath: lapAmount
|
||||
value: 3
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5365138393421743302, guid: dc3e6243ce610df4c845a9fa5df754a7, type: 3}
|
||||
propertyPath: lapCounter
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -22,6 +23,7 @@ public class GameManager : MonoBehaviour
|
||||
// reset laps
|
||||
playerLaps = new int[players.Count()];
|
||||
playerTimes = new float[players.Count()];
|
||||
playerTimesStr = new string[players.Count()];
|
||||
|
||||
for (int i = 0; i < playerLaps.Count(); i++)
|
||||
{
|
||||
@@ -30,7 +32,8 @@ public class GameManager : MonoBehaviour
|
||||
|
||||
for (int i = 0; i < players.Count(); i++)
|
||||
{
|
||||
playerTimes[i] = 0;
|
||||
playerTimes[i] = 0.00000001f;
|
||||
playerTimesStr[i] = "DNF";
|
||||
}
|
||||
|
||||
DontDestroyOnLoad(gameObject);
|
||||
@@ -82,7 +85,18 @@ public class GameManager : MonoBehaviour
|
||||
lapCounter.text = "Lap count: " + playerLaps[i];
|
||||
}
|
||||
|
||||
timeCounter.text = "Time: " + playerTimes[i].ToString();
|
||||
string strTimes =playerTimes[i].ToString();
|
||||
|
||||
int seconds = (int)MathF.Floor(playerTimes[i]);
|
||||
int seperator = strTimes.IndexOf(",");
|
||||
string miliseconds;
|
||||
|
||||
if (strTimes.Length < seperator + 4)
|
||||
miliseconds = ",000";
|
||||
else
|
||||
miliseconds = strTimes.Substring(seperator, 4);
|
||||
|
||||
timeCounter.text = "Time: " + seconds + miliseconds;
|
||||
}
|
||||
|
||||
if (playerLaps[i] > lapAmount)
|
||||
@@ -104,7 +118,6 @@ public class GameManager : MonoBehaviour
|
||||
// race finished
|
||||
if (playersFinished.Count() == players.Count())
|
||||
{
|
||||
// if not finished DNF //TODO
|
||||
SceneManager.LoadScene("WinScreen");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user