Car customization should fully work
This commit is contained in:
@@ -1758,7 +1758,7 @@ Transform:
|
||||
m_GameObject: {fileID: 153506}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -640.6719, y: 0, z: 100.35948}
|
||||
m_LocalPosition: {x: -860.12476, y: 0, z: 100.35948}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f58d25b9e504a4f41ab4a71cf87c1845
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
1
Assets/ML-Agents/Timers/Car Customization_timers.json
Normal file
1
Assets/ML-Agents/Timers/Car Customization_timers.json
Normal file
@@ -0,0 +1 @@
|
||||
{"count":1,"self":9.9214583999999988,"total":10.0039322,"children":{"InitializeActuators":{"count":3,"self":0.0015027999999999999,"total":0.0015027999999999999,"children":null},"InitializeSensors":{"count":3,"self":0.001,"total":0.001,"children":null},"AgentSendState":{"count":1,"self":0.0035026999999999997,"total":0.0157385,"children":{"CollectObservations":{"count":3,"self":0.0020212,"total":0.0020212,"children":null},"WriteActionMask":{"count":3,"self":0,"total":0,"children":null},"RequestDecision":{"count":3,"self":0.010214599999999999,"total":0.010214599999999999,"children":null}}},"DecideAction":{"count":1,"self":0.0632322,"total":0.0632322,"children":{"RayPerceptionSensor.Perceive":{"count":6,"self":0,"total":0,"children":null}}},"AgentAct":{"count":1,"self":0.0010000999999999999,"total":0.0010000999999999999,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1713869954","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 249cbe37-b739-48da-be83-8703208ec644 -accessToken 8HP4BNN_d2rYa9gBqxxeXFjsh8NpNokVC4_Asgt7liQ005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"Car Customization","end_time_seconds":"1713869964"}}
|
||||
@@ -1,6 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 58f7e79a87c79824597746e8c1bfe400
|
||||
DefaultImporter:
|
||||
guid: 0f6dd878df25b634c9176312135bf2ac
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
@@ -1,5 +1 @@
|
||||
<<<<<<< HEAD
|
||||
{"count":1,"self":10.982344,"total":11.1048147,"children":{"InitializeActuators":{"count":1,"self":0.0010012999999999999,"total":0.0010012999999999999,"children":null},"InitializeSensors":{"count":1,"self":0.0015044,"total":0.0015044,"children":null},"AgentSendState":{"count":321,"self":0.008182,"total":0.0197174,"children":{"CollectObservations":{"count":65,"self":0.0025157,"total":0.0025157,"children":null},"WriteActionMask":{"count":65,"self":0,"total":0,"children":null},"RequestDecision":{"count":65,"self":0.0090197,"total":0.0090197,"children":null}}},"DecideAction":{"count":321,"self":0.086684299999999992,"total":0.086684299999999992,"children":{"RayPerceptionSensor.Perceive":{"count":130,"self":0,"total":0,"children":null}}},"AgentAct":{"count":321,"self":0.012562,"total":0.012562,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1713861459","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 249cbe37-b739-48da-be83-8703208ec644 -accessToken 8HP4BNN_d2rYa9gBqxxeXFjsh8NpNokVC4_Asgt7liQ005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"Racetrack mini","end_time_seconds":"1713861470"}}
|
||||
=======
|
||||
{"count":1,"self":67.02152319999999,"total":68.75985519999999,"children":{"InitializeActuators":{"count":1,"self":0.00099969999999999985,"total":0.00099969999999999985,"children":null},"InitializeSensors":{"count":1,"self":0.0029919,"total":0.0029919,"children":null},"AgentSendState":{"count":3173,"self":0.0853182,"total":0.146277,"children":{"CollectObservations":{"count":635,"self":0.0375563,"total":0.0375563,"children":null},"WriteActionMask":{"count":635,"self":0.0019976,"total":0.0019976,"children":null},"RequestDecision":{"count":635,"self":0.021404899999999998,"total":0.021404899999999998,"children":null}}},"DecideAction":{"count":3173,"self":1.3692536,"total":1.3805634,"children":{"RayPerceptionSensor.Perceive":{"count":1270,"self":0.0113098,"total":0.0113098,"children":null}}},"AgentAct":{"count":3173,"self":0.20445629999999998,"total":0.20445629999999998,"children":null}},"gauges":{"BensonV6.1.CumulativeReward":{"count":2,"max":25.4223919,"min":12.8763666,"runningAverage":19.14938,"value":12.8763666,"weightedAverage":22.2858849}},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1713860886","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 85628495-4bbf-4ebf-9a76-a3f42df70699 -accessToken SYITqeuCKSOmslEUEeguWUuVHsXrKJl43gox_St5y34005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"Racetrack mini","end_time_seconds":"1713860954"}}
|
||||
>>>>>>> 2990a061aeca8ed1ac64145cadd8b499f1d65402
|
||||
{"count":1,"self":54.644422399999996,"total":55.204959499999994,"children":{"InitializeActuators":{"count":3,"self":0.0010004,"total":0.0010004,"children":null},"InitializeSensors":{"count":3,"self":0.00207,"total":0.00207,"children":null},"AgentSendState":{"count":2490,"self":0.057719299999999994,"total":0.094764599999999991,"children":{"CollectObservations":{"count":1494,"self":0.0245773,"total":0.0245773,"children":null},"WriteActionMask":{"count":1494,"self":0.0034568999999999997,"total":0.0034568999999999997,"children":null},"RequestDecision":{"count":1494,"self":0.0090111,"total":0.0090111,"children":null}}},"DecideAction":{"count":2490,"self":0.3347505,"total":0.3373478,"children":{"RayPerceptionSensor.Perceive":{"count":2988,"self":0.0025973,"total":0.0025973,"children":null}}},"AgentAct":{"count":2490,"self":0.1243512,"total":0.1243512,"children":null}},"gauges":{"BensonV6.1.CumulativeReward":{"count":4,"max":5.881892,"min":-1.28988469,"runningAverage":1.71058607,"value":1.6363852,"weightedAverage":1.05411792}},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1713869979","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 249cbe37-b739-48da-be83-8703208ec644 -accessToken 8HP4BNN_d2rYa9gBqxxeXFjsh8NpNokVC4_Asgt7liQ005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"Racetrack mini","end_time_seconds":"1713870034"}}
|
||||
@@ -276,7 +276,7 @@ GameObject:
|
||||
- component: {fileID: 5022958917504388741}
|
||||
- component: {fileID: 2357909291779874818}
|
||||
m_Layer: 0
|
||||
m_Name: RaceCar
|
||||
m_Name: Racecar
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
|
||||
@@ -1034,6 +1034,11 @@ GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 5471432146962600635, guid: 72f36551c0bfff14fa73ab0c8bb3b28f, type: 3}
|
||||
m_PrefabInstance: {fileID: 319703284}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &358447329 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 3730747174356696648, guid: dc3e6243ce610df4c845a9fa5df754a7, type: 3}
|
||||
m_PrefabInstance: {fileID: 637686386}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &426378878
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1237,6 +1242,7 @@ MonoBehaviour:
|
||||
- {fileID: 2100000, guid: cb13a603242ea654885b9973cf7c97c0, type: 2}
|
||||
- {fileID: 2100000, guid: 290dcb9964b00e94bb0debc820182e71, type: 2}
|
||||
startButton: {fileID: 1240586970}
|
||||
carData: {fileID: 358447329}
|
||||
--- !u!81 &481224848
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1564,6 +1570,10 @@ PrefabInstance:
|
||||
propertyPath: m_IsActive
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5081994082839948773, guid: dc3e6243ce610df4c845a9fa5df754a7, type: 3}
|
||||
propertyPath: carType
|
||||
value: Hotrod
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5081994082839948773, guid: dc3e6243ce610df4c845a9fa5df754a7, type: 3}
|
||||
propertyPath: playerCar
|
||||
value:
|
||||
@@ -1750,7 +1760,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 892975331452299942, guid: a34d17982603e394b85abe66729deb02, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Bolide
|
||||
value: Racecar
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
@@ -2107,7 +2117,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 906545427714165447, guid: 329c3d78ac09e334fb65c9fe92616bc6, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Coupe
|
||||
value: StreetRacist
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -33,8 +33,7 @@ public class AgentControllerV6 : Agent
|
||||
public int distanceBetweenCheckpoints = 5;
|
||||
public bool ignoreMentalPain = false;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
void Awake()
|
||||
{
|
||||
rigidBody = GetComponent<Rigidbody>();
|
||||
// Find all child GameObjects that have the WheelControl script attached
|
||||
@@ -42,7 +41,11 @@ public class AgentControllerV6 : Agent
|
||||
|
||||
startPosition = transform.localPosition;
|
||||
startRotation = transform.localRotation;
|
||||
|
||||
}
|
||||
|
||||
protected override void OnDisable()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public override void OnEpisodeBegin()
|
||||
|
||||
@@ -8,6 +8,7 @@ using UnityEngine.UI;
|
||||
public class Garage : MonoBehaviour
|
||||
{
|
||||
GameObject CurrentCar;
|
||||
string currentColor = "Default";
|
||||
public Button[] CarButtons;
|
||||
public GameObject[] Garages;
|
||||
public GameObject[] CarBodies;
|
||||
@@ -15,6 +16,7 @@ public class Garage : MonoBehaviour
|
||||
public Material[] Colors;
|
||||
quaternion currentRotation;
|
||||
public Button startButton;
|
||||
public GameObject carData;
|
||||
void Start()
|
||||
{
|
||||
CarButtons[0].onClick.AddListener(SelectHotrod);
|
||||
@@ -64,11 +66,14 @@ public class Garage : MonoBehaviour
|
||||
Garages[i].SetActive(true);
|
||||
CurrentCar = CarBodies[i];
|
||||
CurrentCar.transform.rotation = currentRotation;
|
||||
currentColor = "Default";
|
||||
}
|
||||
|
||||
void startGame()
|
||||
{
|
||||
SceneManager.LoadScene("Racetrack mini");
|
||||
carData.GetComponent<CarData>().carType = CurrentCar.name;
|
||||
carData.GetComponent<CarData>().carColor = currentColor;
|
||||
}
|
||||
|
||||
void SelectHotrod()
|
||||
@@ -115,71 +120,83 @@ public class Garage : MonoBehaviour
|
||||
{
|
||||
Material color = Colors[0];
|
||||
CurrentCar.GetComponent<ChangeCarColor>().ChangeColor(color);
|
||||
currentColor = "Black";
|
||||
}
|
||||
|
||||
void SelectBlue()
|
||||
{
|
||||
Material color = Colors[1];
|
||||
CurrentCar.GetComponent<ChangeCarColor>().ChangeColor(color);
|
||||
currentColor = "Blue";
|
||||
}
|
||||
|
||||
void SelectBrown()
|
||||
{
|
||||
Material color = Colors[2];
|
||||
CurrentCar.GetComponent<ChangeCarColor>().ChangeColor(color);
|
||||
currentColor = "Brown";
|
||||
}
|
||||
|
||||
void SelectGray()
|
||||
{
|
||||
Material color = Colors[3];
|
||||
CurrentCar.GetComponent<ChangeCarColor>().ChangeColor(color);
|
||||
currentColor = "Gray";
|
||||
}
|
||||
|
||||
void SelectGreen()
|
||||
{
|
||||
Material color = Colors[4];
|
||||
CurrentCar.GetComponent<ChangeCarColor>().ChangeColor(color);
|
||||
currentColor = "Green";
|
||||
}
|
||||
|
||||
void SelectOrange()
|
||||
{
|
||||
Material color = Colors[5];
|
||||
CurrentCar.GetComponent<ChangeCarColor>().ChangeColor(color);
|
||||
currentColor = "Orange";
|
||||
}
|
||||
|
||||
void SelectPink()
|
||||
{
|
||||
Material color = Colors[6];
|
||||
CurrentCar.GetComponent<ChangeCarColor>().ChangeColor(color);
|
||||
currentColor = "Pink";
|
||||
}
|
||||
|
||||
void SelectRed()
|
||||
{
|
||||
Material color = Colors[7];
|
||||
CurrentCar.GetComponent<ChangeCarColor>().ChangeColor(color);
|
||||
currentColor = "Red";
|
||||
}
|
||||
|
||||
void SelectTurquoise()
|
||||
{
|
||||
Material color = Colors[8];
|
||||
CurrentCar.GetComponent<ChangeCarColor>().ChangeColor(color);
|
||||
currentColor = "Turquoise";
|
||||
}
|
||||
|
||||
void SelectViolet()
|
||||
{
|
||||
Material color = Colors[9];
|
||||
CurrentCar.GetComponent<ChangeCarColor>().ChangeColor(color);
|
||||
currentColor = "Violet";
|
||||
}
|
||||
|
||||
void SelectWhite()
|
||||
{
|
||||
Material color = Colors[10];
|
||||
CurrentCar.GetComponent<ChangeCarColor>().ChangeColor(color);
|
||||
currentColor = "White";
|
||||
}
|
||||
|
||||
void SelectYellow()
|
||||
{
|
||||
Material color = Colors[11];
|
||||
CurrentCar.GetComponent<ChangeCarColor>().ChangeColor(color);
|
||||
currentColor = "Yellow";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
|
||||
public class CarData : MonoBehaviour
|
||||
{
|
||||
public GameObject playerCar;
|
||||
public string carType;
|
||||
public string carColor;
|
||||
private void Awake() {
|
||||
DontDestroyOnLoad(gameObject);
|
||||
}
|
||||
@@ -1,25 +1,92 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Cinemachine;
|
||||
using Unity.Burst.Intrinsics;
|
||||
using UnityEngine;
|
||||
|
||||
public class CarLoader : MonoBehaviour
|
||||
{
|
||||
public GameObject Hotrod;
|
||||
GameObject playerCar;
|
||||
public GameObject[] Cars;
|
||||
string carType;
|
||||
string carColor;
|
||||
public Material[] Colors;
|
||||
public CinemachineVirtualCamera vcam;
|
||||
void Start()
|
||||
{
|
||||
playerCar = GameObject.Find("Car Data").GetComponent<CarData>().playerCar;
|
||||
|
||||
replaceCar(Hotrod);
|
||||
carType = GameObject.Find("Car Data").GetComponent<CarData>().carType;
|
||||
carColor = GameObject.Find("Car Data").GetComponent<CarData>().carColor;
|
||||
|
||||
foreach (GameObject car in Cars)
|
||||
{
|
||||
if (car.name == carType)
|
||||
{
|
||||
replaceCar(car, carColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void replaceCar(GameObject car)
|
||||
void replaceCar(GameObject car, string color)
|
||||
{
|
||||
Transform carTransform = car.transform;
|
||||
car.GetComponent<carcontrolv2>().enabled = true;
|
||||
car.GetComponent<AgentControllerV6>().enabled = false;
|
||||
|
||||
playerCar.transform.position = carTransform.position;
|
||||
playerCar.transform.rotation = carTransform.rotation;
|
||||
playerCar.transform.localScale = carTransform.localScale;
|
||||
vcam.Follow = car.transform;
|
||||
vcam.LookAt = car.transform;
|
||||
|
||||
if (color == "Default")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (color == "Black")
|
||||
{
|
||||
car.GetComponent<ChangeCarColor>().ChangeColor(Colors[0]);
|
||||
}
|
||||
if (color == "Blue")
|
||||
{
|
||||
car.GetComponent<ChangeCarColor>().ChangeColor(Colors[1]);
|
||||
}
|
||||
if (color == "Brown")
|
||||
{
|
||||
car.GetComponent<ChangeCarColor>().ChangeColor(Colors[2]);
|
||||
}
|
||||
if (color == "Gray")
|
||||
{
|
||||
car.GetComponent<ChangeCarColor>().ChangeColor(Colors[3]);
|
||||
}
|
||||
if (color == "Green")
|
||||
{
|
||||
car.GetComponent<ChangeCarColor>().ChangeColor(Colors[4]);
|
||||
}
|
||||
if (color == "Orange")
|
||||
{
|
||||
car.GetComponent<ChangeCarColor>().ChangeColor(Colors[5]);
|
||||
}
|
||||
if (color == "Pink")
|
||||
{
|
||||
car.GetComponent<ChangeCarColor>().ChangeColor(Colors[6]);
|
||||
}
|
||||
if (color == "Red")
|
||||
{
|
||||
car.GetComponent<ChangeCarColor>().ChangeColor(Colors[7]);
|
||||
}
|
||||
if (color == "Turquoise")
|
||||
{
|
||||
car.GetComponent<ChangeCarColor>().ChangeColor(Colors[8]);
|
||||
}
|
||||
if (color == "Violet")
|
||||
{
|
||||
car.GetComponent<ChangeCarColor>().ChangeColor(Colors[9]);
|
||||
}
|
||||
if (color == "White")
|
||||
{
|
||||
car.GetComponent<ChangeCarColor>().ChangeColor(Colors[10]);
|
||||
}
|
||||
if (color == "Yellow")
|
||||
{
|
||||
car.GetComponent<ChangeCarColor>().ChangeColor(Colors[11]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public class carcontrolv2 : MonoBehaviour
|
||||
|
||||
if (other.gameObject.tag == "Wall")
|
||||
{
|
||||
audio.Play();
|
||||
// audio.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user