diff --git a/Assets/ML-Agents/Timers/ForestRacetrack_timers.json b/Assets/ML-Agents/Timers/ForestRacetrack_timers.json index a30c934..556eafe 100644 --- a/Assets/ML-Agents/Timers/ForestRacetrack_timers.json +++ b/Assets/ML-Agents/Timers/ForestRacetrack_timers.json @@ -1 +1,5 @@ -{"count":1,"self":32.8065536,"total":36.7679407,"children":{"InitializeActuators":{"count":8,"self":0.0040387999999999995,"total":0.0040387999999999995,"children":null},"InitializeSensors":{"count":8,"self":0.0029939999999999997,"total":0.0029939999999999997,"children":null},"AgentSendState":{"count":1587,"self":0.3011096,"total":0.3888908,"children":{"CollectObservations":{"count":2544,"self":0.044843,"total":0.044843,"children":null},"WriteActionMask":{"count":2544,"self":0.0105366,"total":0.0105366,"children":null},"RequestDecision":{"count":2544,"self":0.032401599999999996,"total":0.032401599999999996,"children":null}}},"DecideAction":{"count":1587,"self":3.2400292,"total":3.2936266,"children":{"RayPerceptionSensor.Perceive":{"count":5088,"self":0.053597399999999996,"total":0.053597399999999996,"children":null}}},"AgentAct":{"count":1587,"self":0.2688357,"total":0.2688357,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1714130182","unity_version":"2022.3.11f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2022.3.11f1\\Editor\\Unity.exe -projectpath C:\\Users\\Magnus\\Desktop\\Ny unityting\\Racesm -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-Magnus -hubSessionId 8c17471b-7795-4082-905c-75744d6a077b -accessToken hv3zp4IA8nxcowfZc35r5tDHrlmzUZoExTBgESksngo005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"ForestRacetrack","end_time_seconds":"1714130219"}} \ No newline at end of file +<<<<<<< HEAD +{"count":1,"self":32.8065536,"total":36.7679407,"children":{"InitializeActuators":{"count":8,"self":0.0040387999999999995,"total":0.0040387999999999995,"children":null},"InitializeSensors":{"count":8,"self":0.0029939999999999997,"total":0.0029939999999999997,"children":null},"AgentSendState":{"count":1587,"self":0.3011096,"total":0.3888908,"children":{"CollectObservations":{"count":2544,"self":0.044843,"total":0.044843,"children":null},"WriteActionMask":{"count":2544,"self":0.0105366,"total":0.0105366,"children":null},"RequestDecision":{"count":2544,"self":0.032401599999999996,"total":0.032401599999999996,"children":null}}},"DecideAction":{"count":1587,"self":3.2400292,"total":3.2936266,"children":{"RayPerceptionSensor.Perceive":{"count":5088,"self":0.053597399999999996,"total":0.053597399999999996,"children":null}}},"AgentAct":{"count":1587,"self":0.2688357,"total":0.2688357,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1714130182","unity_version":"2022.3.11f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2022.3.11f1\\Editor\\Unity.exe -projectpath C:\\Users\\Magnus\\Desktop\\Ny unityting\\Racesm -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-Magnus -hubSessionId 8c17471b-7795-4082-905c-75744d6a077b -accessToken hv3zp4IA8nxcowfZc35r5tDHrlmzUZoExTBgESksngo005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"ForestRacetrack","end_time_seconds":"1714130219"}} +======= +{"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"}} +>>>>>>> 8744c617fc8715a42e6dd73e481f756db2205086 diff --git a/Assets/Scenes/ForestRacetrack.unity b/Assets/Scenes/ForestRacetrack.unity index 334c121..f140bbb 100644 --- a/Assets/Scenes/ForestRacetrack.unity +++ b/Assets/Scenes/ForestRacetrack.unity @@ -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 diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index c475ecf..b67912f 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -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"); }