From 8f6e3ffa2134c577ad2813e70e994740ff5be4eb Mon Sep 17 00:00:00 2001 From: magn9775 Date: Fri, 19 Apr 2024 11:31:12 +0200 Subject: [PATCH] ui? --- Assets/Prefabs/Tracks/OffRoadTrack.prefab | 75 ----------------------- Assets/Scenes/Racetrack.unity | 13 ++-- Assets/Scripts/UI scripts/GameUI.cs | 10 ++- 3 files changed, 15 insertions(+), 83 deletions(-) diff --git a/Assets/Prefabs/Tracks/OffRoadTrack.prefab b/Assets/Prefabs/Tracks/OffRoadTrack.prefab index e649c9a..700f5d5 100644 --- a/Assets/Prefabs/Tracks/OffRoadTrack.prefab +++ b/Assets/Prefabs/Tracks/OffRoadTrack.prefab @@ -82,7 +82,6 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 2089599405993210120} - - {fileID: 6910657865482355608} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &517737349064952996 @@ -1249,80 +1248,6 @@ Transform: m_CorrespondingSourceObject: {fileID: 1279437348525638701, guid: e2e682b966e3f644392ffbfab511e0e2, type: 3} m_PrefabInstance: {fileID: 6134520914307201963} m_PrefabAsset: {fileID: 0} ---- !u!1001 &6914808702520983802 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 4410338557763827223} - m_Modifications: - - target: {fileID: 1685004736896436, guid: 8d0bec0dc9ff9204bb3391cc6cb2c885, type: 3} - propertyPath: m_Name - value: EA03_Prop_Pier_03d_PRE - objectReference: {fileID: 0} - - target: {fileID: 4999849139159906, guid: 8d0bec0dc9ff9204bb3391cc6cb2c885, type: 3} - propertyPath: m_LocalScale.x - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 4999849139159906, guid: 8d0bec0dc9ff9204bb3391cc6cb2c885, type: 3} - propertyPath: m_LocalScale.y - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 4999849139159906, guid: 8d0bec0dc9ff9204bb3391cc6cb2c885, type: 3} - propertyPath: m_LocalScale.z - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 4999849139159906, guid: 8d0bec0dc9ff9204bb3391cc6cb2c885, type: 3} - propertyPath: m_LocalPosition.x - value: -66.6138 - objectReference: {fileID: 0} - - target: {fileID: 4999849139159906, guid: 8d0bec0dc9ff9204bb3391cc6cb2c885, type: 3} - propertyPath: m_LocalPosition.y - value: -17.81 - objectReference: {fileID: 0} - - target: {fileID: 4999849139159906, guid: 8d0bec0dc9ff9204bb3391cc6cb2c885, type: 3} - propertyPath: m_LocalPosition.z - value: 18.163359 - objectReference: {fileID: 0} - - target: {fileID: 4999849139159906, guid: 8d0bec0dc9ff9204bb3391cc6cb2c885, type: 3} - propertyPath: m_LocalRotation.w - value: 0.3226137 - objectReference: {fileID: 0} - - target: {fileID: 4999849139159906, guid: 8d0bec0dc9ff9204bb3391cc6cb2c885, type: 3} - propertyPath: m_LocalRotation.x - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 4999849139159906, guid: 8d0bec0dc9ff9204bb3391cc6cb2c885, type: 3} - propertyPath: m_LocalRotation.y - value: 0.9465307 - objectReference: {fileID: 0} - - target: {fileID: 4999849139159906, guid: 8d0bec0dc9ff9204bb3391cc6cb2c885, type: 3} - propertyPath: m_LocalRotation.z - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 4999849139159906, guid: 8d0bec0dc9ff9204bb3391cc6cb2c885, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4999849139159906, guid: 8d0bec0dc9ff9204bb3391cc6cb2c885, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 142.358 - objectReference: {fileID: 0} - - target: {fileID: 4999849139159906, guid: 8d0bec0dc9ff9204bb3391cc6cb2c885, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 8d0bec0dc9ff9204bb3391cc6cb2c885, type: 3} ---- !u!4 &6910657865482355608 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 4999849139159906, guid: 8d0bec0dc9ff9204bb3391cc6cb2c885, type: 3} - m_PrefabInstance: {fileID: 6914808702520983802} - m_PrefabAsset: {fileID: 0} --- !u!1001 &7665355901869235984 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/Racetrack.unity b/Assets/Scenes/Racetrack.unity index a3719ce..09ebf72 100644 --- a/Assets/Scenes/Racetrack.unity +++ b/Assets/Scenes/Racetrack.unity @@ -496,6 +496,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1429604867} + - {fileID: 1303067121} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} @@ -728,12 +729,12 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1303067118} serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -960, y: -540, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 0} + m_Father: {fileID: 1032240017} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1303067122 MonoBehaviour: @@ -749,6 +750,7 @@ MonoBehaviour: m_EditorClassIdentifier: car: {fileID: 86731284} carRB: {fileID: 86731289} + speedometer: {fileID: 0} --- !u!1 &1429604866 GameObject: m_ObjectHideFlags: 0 @@ -774,7 +776,7 @@ RectTransform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1429604866} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 @@ -806,7 +808,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_text: + m_text: L m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} @@ -1170,7 +1172,6 @@ SceneRoots: - {fileID: 8222889276702183714} - {fileID: 2034582631126909176} - {fileID: 1032240017} - - {fileID: 1303067121} - {fileID: 437868554} - {fileID: 467812079} - {fileID: 1239887511} diff --git a/Assets/Scripts/UI scripts/GameUI.cs b/Assets/Scripts/UI scripts/GameUI.cs index bbede56..b02e110 100644 --- a/Assets/Scripts/UI scripts/GameUI.cs +++ b/Assets/Scripts/UI scripts/GameUI.cs @@ -12,9 +12,15 @@ public class GameUI : MonoBehaviour public GameObject car; private float carVel; public Rigidbody carRB; + + public TextMeshPro speedometer; // Start is called before the first frame update void Start() { + if (speedometer == null) + { + speedometer = new TextMeshPro(); + } if (carRB == null) { carRB = GetComponent(); @@ -25,7 +31,7 @@ public class GameUI : MonoBehaviour void Update() { carVel = (math.abs(carRB.velocity.x) + math.abs(carRB.velocity.y) + math.abs(carRB.velocity.z))*5; - print(carVel); - + //print(carVel); + speedometer.SetText(carVel.ToString()); } }