Merge branch 'master' of git@ooftooft.net:Racesm.git

# Conflicts:
#	Assets/ML-Agents/Timers/Racetrack mini_timers.json
This commit is contained in:
PokingPines
2024-04-25 15:09:42 +02:00
8 changed files with 1515 additions and 1080 deletions

Binary file not shown.

View File

@@ -0,0 +1,16 @@
fileFormatVersion: 2
guid: 0a7181c8b969e1346b8a4323695aea4d
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 683b6cb6d0a474744822c888b46772c9, type: 3}
optimizeModel: 1
forceArbitraryBatchSize: 1
treatErrorsAsWarnings: 0
importMode: 1
weightsTypeMode: 0
activationTypeMode: 0

View File

@@ -1758,7 +1758,7 @@ Transform:
m_GameObject: {fileID: 153506}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -944.5319, y: 0, z: 100.35948}
m_LocalPosition: {x: -1493.103, y: 0, z: 100.35948}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:

View File

@@ -1 +1 @@
{"count":1,"self":23.543504,"total":23.684340499999998,"children":{"InitializeActuators":{"count":4,"self":0.0025702,"total":0.0025702,"children":null},"InitializeSensors":{"count":4,"self":0.0015998,"total":0.0015998,"children":null},"AgentSendState":{"count":854,"self":0.0776738,"total":0.1268799,"children":{"CollectObservations":{"count":623,"self":0.042767099999999995,"total":0.042767099999999995,"children":null},"WriteActionMask":{"count":208,"self":0.0010039,"total":0.0010039,"children":null},"RequestDecision":{"count":208,"self":0.0016899999999999999,"total":0.0054351,"children":{"RayPerceptionSensor.Perceive":{"count":416,"self":0.0037451,"total":0.0037451,"children":null}}}}},"DecideAction":{"count":439,"self":0.0060196999999999994,"total":0.0060196999999999994,"children":null},"AgentAct":{"count":439,"self":0.0027661,"total":0.0027661,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1714049924","unity_version":"2022.3.11f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2022.3.11f1\\Editor\\Unity.exe -projectpath C:\\Users\\hassa\\OneDrive\\Skrivebord\\alt pro\\Unity stuff\\Unity ting\\Racesm -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-hassa -hubSessionId 9c1f01bb-11a4-4f0f-a783-b9132e478973 -accessToken 4E81NOgN5ztdhX4t4u3WEoX4xouq9HnIn-2L54HpD0Y005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"Racetrack mini","end_time_seconds":"1714049948"}}
{"count":1,"self":63.0971136,"total":66.1027678,"children":{"InitializeActuators":{"count":8,"self":0.0020309,"total":0.0020309,"children":null},"InitializeSensors":{"count":8,"self":0.0020301,"total":0.0020301,"children":null},"AgentSendState":{"count":3031,"self":0.6190017,"total":0.7800591,"children":{"CollectObservations":{"count":4856,"self":0.100322,"total":0.100322,"children":null},"WriteActionMask":{"count":4856,"self":0.0136265,"total":0.0136265,"children":null},"RequestDecision":{"count":4856,"self":0.047108899999999995,"total":0.047108899999999995,"children":null}}},"DecideAction":{"count":3031,"self":1.648466,"total":1.7078605999999998,"children":{"RayPerceptionSensor.Perceive":{"count":9712,"self":0.0593946,"total":0.0593946,"children":null}}},"AgentAct":{"count":3031,"self":0.5116655,"total":0.5116655,"children":null}},"gauges":{"Benson Track2.CumulativeReward":{"count":19,"max":24.4291973,"min":-2.030752,"runningAverage":3.0816896,"value":10.1723137,"weightedAverage":4.260365}},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1714050153","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 FV38BX0LdlmK-m4amNy3jH1hDBMyOs3Ki2__yJqeaFY005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"Racetrack mini","end_time_seconds":"1714050219"}}

View File

@@ -400,7 +400,7 @@ GameObject:
- component: {fileID: 1459545008135898659}
- component: {fileID: 4029776548783016511}
m_Layer: 0
m_Name: RaceCar
m_Name: Racecar
m_TagString: Player
m_Icon: {fileID: 0}
m_NavMeshLayer: 0

File diff suppressed because it is too large Load Diff

View File

@@ -5,7 +5,7 @@ using Unity.VisualScripting;
using UnityEngine;
//script from FREAKINGREX, but minor changes to integrate it proberly
//script from FREAKINGREX, but changes to integrate it proberly/ work how we want it to work
//https://assetstore.unity.com/packages/templates/systems/arcade-car-controller-lite-version-145489
public class CameraControl :MonoBehaviour
@@ -68,6 +68,7 @@ public class CameraControl :MonoBehaviour
transform.position = Vector3.LerpUnclamped (transform.position, TargetPoint, Time.deltaTime * ActivePreset.SetPositionSpeed);
if (Input.GetKeyDown (SetCameraKey))
{
SetNextCamera ();
@@ -111,6 +112,7 @@ public class CameraControl :MonoBehaviour
public void UpdateActiveCamera ()
{
if (ActivePreset != null)
{
ActivePreset.CameraHolder.SetActive(false);

View File

@@ -13,49 +13,42 @@ public class GameController :MonoBehaviour
[SerializeField] UnityEngine.UI.Button NextCarButton;
public static GameController Instance;
public GameObject PlayerCar;
public GameObject cam;
public static bool RaceIsStarted { get { return true; } }
public static bool RaceIsEnded { get { return false; } }
PlayerController m_PlayerCar;
List<PlayerController> Cars = new List<PlayerController>();
//PlayerController m_PlayerCar;
//List<PlayerController> Cars = new List<PlayerController>();
public List<GameObject> cars;
int CurrentCarIndex = 0;
protected virtual void Awake ()
{
Instance = this;
//Find all cars in current game.
Cars.AddRange (GameObject.FindObjectsOfType<PlayerController> ());
Cars = Cars.OrderBy (c => c.name).ToList();
// foreach (var car in cars)
// {
// var userControl = car.GetComponent<PlayerController>();
// var audioListener = car.GetComponent<AudioListener>();
foreach (var car in Cars)
{
var userControl = car.GetComponent<PlayerController>();
var audioListener = car.GetComponent<AudioListener>();
// if (userControl == null)
// {
// userControl = car.gameObject.AddComponent<PlayerController> ();
// }
if (userControl == null)
{
userControl = car.gameObject.AddComponent<PlayerController> ();
}
// if (audioListener == null)
// {
// audioListener = car.gameObject.AddComponent<AudioListener> ();
// }
if (audioListener == null)
{
audioListener = car.gameObject.AddComponent<AudioListener> ();
}
// userControl.enabled = false;
// audioListener.enabled = false;
// }
userControl.enabled = false;
audioListener.enabled = false;
}
m_PlayerCar = Cars[0];
m_PlayerCar.GetComponent<PlayerController> ().enabled = true;
m_PlayerCar.GetComponent<AudioListener> ().enabled = true;
if (NextCarButton)
{
NextCarButton.onClick.AddListener (NextCar);
}
// cars[CurrentCarIndex].GetComponent<PlayerController>().enabled = true;
// cars[CurrentCarIndex].GetComponent<AudioListener>().enabled = true;
}
void Update ()
@@ -69,14 +62,20 @@ public class GameController :MonoBehaviour
private void NextCar ()
{
m_PlayerCar.GetComponent<PlayerController> ().enabled = false;
m_PlayerCar.GetComponent<AudioListener> ().enabled = false;
// cars[CurrentCarIndex].GetComponent<PlayerController> ().enabled = false;
// cars[CurrentCarIndex].GetComponent<AudioListener> ().enabled = false;
CurrentCarIndex = LoopClamp (CurrentCarIndex + 1, 0, Cars.Count);
CurrentCarIndex = LoopClamp (CurrentCarIndex + 1, 0, cars.Count);
m_PlayerCar = Cars[CurrentCarIndex];
m_PlayerCar.GetComponent<PlayerController> ().enabled = true;
m_PlayerCar.GetComponent<AudioListener> ().enabled = true;
// cars[CurrentCarIndex].GetComponent<PlayerController>().enabled = true;
// cars[CurrentCarIndex].GetComponent<AudioListener>().enabled = true;
PlayerCar = cars[CurrentCarIndex];
cam.GetComponent<CameraControl>().getCar(PlayerCar);
print(PlayerCar.name);
}
public static int LoopClamp (int value, int minValue, int maxValue)