From a9a1c44e75dfe89a8f7651c62cfaced7be32d286 Mon Sep 17 00:00:00 2001 From: Ciakon Date: Fri, 26 Apr 2024 13:31:31 +0200 Subject: [PATCH] lap counter fix --- Assets/ML-Agents/Timers/ForestRacetrack_timers.json | 2 +- Assets/ML-Agents/Timers/WinScreen_timers.json | 2 +- Assets/Scripts/GameManager.cs | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Assets/ML-Agents/Timers/ForestRacetrack_timers.json b/Assets/ML-Agents/Timers/ForestRacetrack_timers.json index d1e336b..0a7a649 100644 --- a/Assets/ML-Agents/Timers/ForestRacetrack_timers.json +++ b/Assets/ML-Agents/Timers/ForestRacetrack_timers.json @@ -1 +1 @@ -{"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"}} \ No newline at end of file +{"count":1,"self":54.697376,"total":56.2490324,"children":{"InitializeActuators":{"count":8,"self":0.0015032,"total":0.0015032,"children":null},"InitializeSensors":{"count":8,"self":0.0028936,"total":0.0028936,"children":null},"AgentSendState":{"count":2580,"self":0.1613813,"total":0.21219159999999998,"children":{"CollectObservations":{"count":4128,"self":0.029130899999999998,"total":0.029130899999999998,"children":null},"WriteActionMask":{"count":4128,"self":0.0045593,"total":0.0045593,"children":null},"RequestDecision":{"count":4128,"self":0.0171201,"total":0.0171201,"children":null}}},"DecideAction":{"count":2580,"self":1.1775138,"total":1.1990912,"children":{"RayPerceptionSensor.Perceive":{"count":8256,"self":0.0215774,"total":0.0215774,"children":null}}},"AgentAct":{"count":2580,"self":0.1349573,"total":0.1349573,"children":null}},"gauges":{"Benson Track2.CumulativeReward":{"count":5,"max":25.06042,"min":23.94484,"runningAverage":24.5239849,"value":24.1170235,"weightedAverage":24.5986176}},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1714131023","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":"1714131080"}} \ No newline at end of file diff --git a/Assets/ML-Agents/Timers/WinScreen_timers.json b/Assets/ML-Agents/Timers/WinScreen_timers.json index 10bd576..6d7f099 100644 --- a/Assets/ML-Agents/Timers/WinScreen_timers.json +++ b/Assets/ML-Agents/Timers/WinScreen_timers.json @@ -1 +1 @@ -{"count":1,"self":170.6430464,"total":189.0146734,"children":{"InitializeActuators":{"count":8,"self":0.0019992,"total":0.0019992,"children":null},"InitializeSensors":{"count":8,"self":0.0019935,"total":0.0019935,"children":null},"AgentSendState":{"count":9173,"self":1.4745792,"total":1.8214966,"children":{"CollectObservations":{"count":11896,"self":0.2234861,"total":0.2234861,"children":null},"WriteActionMask":{"count":11896,"self":0.0479707,"total":0.0479707,"children":null},"RequestDecision":{"count":11896,"self":0.0754606,"total":0.0754606,"children":null}}},"DecideAction":{"count":9173,"self":15.2346224,"total":15.4989647,"children":{"RayPerceptionSensor.Perceive":{"count":23792,"self":0.26434189999999996,"total":0.26434189999999996,"children":null}}},"AgentAct":{"count":9173,"self":1.0441208,"total":1.0441208,"children":null}},"gauges":{"Benson Track2.CumulativeReward":{"count":21,"max":25.6625557,"min":21.0153389,"runningAverage":24.2349434,"value":25.34607,"weightedAverage":25.0115242}},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1714128643","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":"WinScreen","end_time_seconds":"1714128832"}} \ No newline at end of file +{"count":1,"self":119.0030848,"total":122.1256981,"children":{"InitializeActuators":{"count":8,"self":0.002503,"total":0.002503,"children":null},"InitializeSensors":{"count":8,"self":0.0015129,"total":0.0015129,"children":null},"AgentSendState":{"count":4974,"self":0.3274958,"total":0.40929109999999996,"children":{"CollectObservations":{"count":7960,"self":0.041415299999999995,"total":0.041415299999999995,"children":null},"WriteActionMask":{"count":7960,"self":0.0062821,"total":0.0062821,"children":null},"RequestDecision":{"count":7960,"self":0.0340979,"total":0.0340979,"children":null}}},"DecideAction":{"count":4974,"self":2.3696098,"total":2.4060512999999997,"children":{"RayPerceptionSensor.Perceive":{"count":15920,"self":0.0364415,"total":0.0364415,"children":null}}},"AgentAct":{"count":4974,"self":0.30275369999999996,"total":0.30275369999999996,"children":null}},"gauges":{"Benson Track2.CumulativeReward":{"count":7,"max":25.9936028,"min":22.422739,"runningAverage":23.9171925,"value":25.9936028,"weightedAverage":24.25875}},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1714130760","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":"WinScreen","end_time_seconds":"1714130882"}} \ No newline at end of file diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index b67912f..08342b4 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -81,8 +81,11 @@ public class GameManager : MonoBehaviour if (checkpointsCollected == checkpoints.Count()) { player.GetComponent().checkpointsCollected = 0; + playerLaps[i] += 1; - lapCounter.text = "Lap count: " + playerLaps[i]; + + if (playerLaps[i] < lapAmount) + lapCounter.text = "Lap count: " + playerLaps[i]; } string strTimes =playerTimes[i].ToString();