From f2cf92f5bbc4dab6232b4fef40a3b2b3c63fb4af Mon Sep 17 00:00:00 2001 From: magn9775 Date: Fri, 26 Apr 2024 14:20:12 +0200 Subject: [PATCH] win screen done --- Assets/ML-Agents/Timers/WinScreen_timers.json | 2 +- Assets/Scenes/WinScreen.unity | 36 ++++---- Assets/Scripts/WinScript.cs | 88 ++++++++++--------- 3 files changed, 64 insertions(+), 62 deletions(-) diff --git a/Assets/ML-Agents/Timers/WinScreen_timers.json b/Assets/ML-Agents/Timers/WinScreen_timers.json index feb161d..ae3f6db 100644 --- a/Assets/ML-Agents/Timers/WinScreen_timers.json +++ b/Assets/ML-Agents/Timers/WinScreen_timers.json @@ -1 +1 @@ -{"count":1,"self":93.880895999999993,"total":104.3517131,"children":{"InitializeActuators":{"count":8,"self":0.0039383,"total":0.0039383,"children":null},"InitializeSensors":{"count":8,"self":0.0029917,"total":0.0029917,"children":null},"AgentSendState":{"count":4933,"self":0.78385779999999994,"total":0.96388809999999991,"children":{"CollectObservations":{"count":6176,"self":0.1040459,"total":0.1040459,"children":null},"WriteActionMask":{"count":6176,"self":0.016073399999999998,"total":0.016073399999999998,"children":null},"RequestDecision":{"count":6176,"self":0.059911,"total":0.059911,"children":null}}},"DecideAction":{"count":4933,"self":8.8954784,"total":9.0273206999999989,"children":{"RayPerceptionSensor.Perceive":{"count":12352,"self":0.1318426,"total":0.1318426,"children":null}}},"AgentAct":{"count":4933,"self":0.46969289999999997,"total":0.46969289999999997,"children":null}},"gauges":{"Benson Track2.CumulativeReward":{"count":7,"max":25.379261,"min":20.95523,"runningAverage":23.5305214,"value":21.078186,"weightedAverage":23.2197075}},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1714132382","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":"1714132486"}} \ No newline at end of file +{"count":1,"self":312.9512448,"total":322.0418405,"children":{"InitializeActuators":{"count":8,"self":0.0030266,"total":0.0030266,"children":null},"InitializeSensors":{"count":8,"self":0.0020425,"total":0.0020425,"children":null},"AgentSendState":{"count":15820,"self":0.73858099999999993,"total":0.9069683,"children":{"CollectObservations":{"count":5032,"self":0.1044208,"total":0.1044208,"children":null},"WriteActionMask":{"count":5032,"self":0.019871399999999997,"total":0.019871399999999997,"children":null},"RequestDecision":{"count":5032,"self":0.0440951,"total":0.0440951,"children":null}}},"DecideAction":{"count":15820,"self":7.5735176,"total":7.6746079,"children":{"RayPerceptionSensor.Perceive":{"count":10064,"self":0.1010901,"total":0.1010901,"children":null}}},"AgentAct":{"count":15820,"self":0.501961,"total":0.501961,"children":null}},"gauges":{"Benson Track2.CumulativeReward":{"count":7,"max":25.4915333,"min":23.8990974,"runningAverage":24.8208847,"value":25.12378,"weightedAverage":24.8215046}},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1714133660","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":"1714133982"}} \ No newline at end of file diff --git a/Assets/Scenes/WinScreen.unity b/Assets/Scenes/WinScreen.unity index ebff286..da335a5 100644 --- a/Assets/Scenes/WinScreen.unity +++ b/Assets/Scenes/WinScreen.unity @@ -224,8 +224,8 @@ Transform: m_GameObject: {fileID: 53774097} serializedVersion: 2 m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -1.25, y: -1, z: -4} - m_LocalScale: {x: 5, y: 1, z: 5} + m_LocalPosition: {x: -1.25, y: -2, z: -4} + m_LocalScale: {x: 5, y: 2, z: 5} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} @@ -484,7 +484,7 @@ PrefabInstance: m_Modifications: - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalPosition.x - value: -1.25 + value: -1.5 objectReference: {fileID: 0} - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalPosition.y @@ -492,7 +492,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalPosition.z - value: -4 + value: -4.5 objectReference: {fileID: 0} - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalRotation.w @@ -562,7 +562,7 @@ PrefabInstance: m_Modifications: - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalPosition.x - value: -1.25 + value: -1.5 objectReference: {fileID: 0} - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalPosition.y @@ -570,7 +570,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalPosition.z - value: -4 + value: -4.5 objectReference: {fileID: 0} - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalRotation.w @@ -1185,7 +1185,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalPosition.x - value: -1.25 + value: -1.5 objectReference: {fileID: 0} - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalPosition.y @@ -1193,7 +1193,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalPosition.z - value: -4 + value: -4.5 objectReference: {fileID: 0} - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalRotation.w @@ -1267,7 +1267,7 @@ PrefabInstance: m_Modifications: - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalPosition.x - value: -1.25 + value: -1.5 objectReference: {fileID: 0} - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalPosition.y @@ -1275,7 +1275,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalPosition.z - value: -4 + value: -4.5 objectReference: {fileID: 0} - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalRotation.w @@ -1622,7 +1622,7 @@ PrefabInstance: m_Modifications: - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalPosition.x - value: -1.25 + value: -1.5 objectReference: {fileID: 0} - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalPosition.y @@ -1630,7 +1630,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalPosition.z - value: -4 + value: -4.5 objectReference: {fileID: 0} - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalRotation.w @@ -2175,7 +2175,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalPosition.x - value: -1.25 + value: -1.5 objectReference: {fileID: 0} - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalPosition.y @@ -2183,7 +2183,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalPosition.z - value: -4 + value: -4.5 objectReference: {fileID: 0} - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalRotation.w @@ -2531,7 +2531,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalPosition.x - value: -1.25 + value: -1.5 objectReference: {fileID: 0} - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalPosition.y @@ -2539,7 +2539,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalPosition.z - value: -4 + value: -4.5 objectReference: {fileID: 0} - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalRotation.w @@ -2620,7 +2620,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalPosition.x - value: -1.25 + value: -1.5 objectReference: {fileID: 0} - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalPosition.y @@ -2628,7 +2628,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalPosition.z - value: -4 + value: -4.5 objectReference: {fileID: 0} - target: {fileID: 4396357477850336864, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3} propertyPath: m_LocalRotation.w diff --git a/Assets/Scripts/WinScript.cs b/Assets/Scripts/WinScript.cs index 8f9f047..3b217cd 100644 --- a/Assets/Scripts/WinScript.cs +++ b/Assets/Scripts/WinScript.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using UnityEngine; using TMPro; using Unity.VisualScripting; +using System.Linq; public class WinScript : MonoBehaviour { public TextMeshProUGUI MainText; @@ -12,6 +13,7 @@ public class WinScript : MonoBehaviour public GameObject[] Garages; private GameObject currentGarage; + private string playercar = ""; void Start() { @@ -21,50 +23,50 @@ public class WinScript : MonoBehaviour } leaderboard = GameObject.Find("GameManager").GetComponent().playersFinished; time = GameObject.Find("GameManager").GetComponent().playerTimesStr; - if (leaderboard[0].Contains("Player")){ - Garages[0].SetActive(true); - }else{ - if (leaderboard[0] == "Racecar") - { - currentGarage = Garages[6]; - Garages[6].SetActive(true); - } - else if (leaderboard[0] == "Hotrod") - { - currentGarage = Garages[2]; - Garages[2].SetActive(true); - } - else if (leaderboard[0] == "Icecream") - { - currentGarage = Garages[5]; - Garages[5].SetActive(true); - } - else if (leaderboard[0] == "MuscleCar") - { - currentGarage = Garages[1]; - Garages[1].SetActive(true); - } - else if (leaderboard[0] == "Pickup") - { - currentGarage = Garages[3]; - Garages[3].SetActive(true); - } - else if (leaderboard[0] == "SchoolBus") - { - currentGarage = Garages[7]; - Garages[7].SetActive(true); - } - else if (leaderboard[0] == "Sportscar") - { - currentGarage = Garages[4]; - Garages[4].SetActive(true); - } - else if (leaderboard[0] == "StreetRacist") - { - currentGarage = Garages[0]; - Garages[0].SetActive(true); - } + if (leaderboard[0].Contains("player")){ + } + if (leaderboard[0].Contains("Racecar")) + { + currentGarage = Garages[6]; + Garages[6].SetActive(true); + } + else if (leaderboard[0].Contains("Hotrod")) + { + currentGarage = Garages[2]; + Garages[2].SetActive(true); + } + else if (leaderboard[0].Contains("Icecream")) + { + currentGarage = Garages[5]; + Garages[5].SetActive(true); + } + else if (leaderboard[0].Contains("Musclecar")) + { + currentGarage = Garages[1]; + Garages[1].SetActive(true); + } + else if (leaderboard[0].Contains("Pickup")) + { + currentGarage = Garages[3]; + Garages[3].SetActive(true); + } + else if (leaderboard[0].Contains("SchoolBus")) + { + currentGarage = Garages[7]; + Garages[7].SetActive(true); + } + else if (leaderboard[0].Contains("Sportscar")) + { + currentGarage = Garages[4]; + Garages[4].SetActive(true); + } + else if (leaderboard[0].Contains("Streetracist")) + { + currentGarage = Garages[0]; + Garages[0].SetActive(true); + } + }