From 52762e4d87746c7e7599f15013d971bf3371c3f7 Mon Sep 17 00:00:00 2001 From: NomarCub Date: Wed, 11 Dec 2019 15:44:48 +0100 Subject: [PATCH] Automatic car source and destination loading --- Assets/Scenes/CityScene.unity | 642 ++++++------------- Assets/Scripts/Cars/CarController.cs | 5 +- Assets/Scripts/Cars/DestinationForCars.cs | 3 +- Assets/Scripts/Cars/DestinationForParking.cs | 4 +- Assets/Scripts/Cars/DistanceSensor.cs | 3 +- Assets/Scripts/GameManager.cs | 17 +- 6 files changed, 228 insertions(+), 446 deletions(-) diff --git a/Assets/Scenes/CityScene.unity b/Assets/Scenes/CityScene.unity index 4850283..7b88b91 100644 --- a/Assets/Scenes/CityScene.unity +++ b/Assets/Scenes/CityScene.unity @@ -683,18 +683,6 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 747fe745ab83de54487cbc2fa5a45464, type: 3} ---- !u!114 &33173094 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - m_PrefabInstance: {fileID: 1311165999} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 99a3543f95d09ec4baf755888dc99229, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1001 &34164863 PrefabInstance: m_ObjectHideFlags: 0 @@ -4822,18 +4810,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 99a3543f95d09ec4baf755888dc99229, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &195149541 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - m_PrefabInstance: {fileID: 1791521307477027891} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 99a3543f95d09ec4baf755888dc99229, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!4 &195149545 stripped Transform: m_CorrespondingSourceObject: {fileID: 1791521307550520026, guid: 317a31e9e24e8f2408538c895209a83f, @@ -7846,18 +7822,6 @@ Transform: type: 3} m_PrefabInstance: {fileID: 333371152} m_PrefabAsset: {fileID: 0} ---- !u!114 &338249666 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - m_PrefabInstance: {fileID: 1458607896} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 99a3543f95d09ec4baf755888dc99229, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1001 &339761251 PrefabInstance: m_ObjectHideFlags: 0 @@ -8008,18 +7972,6 @@ Transform: type: 3} m_PrefabInstance: {fileID: 339888624} m_PrefabAsset: {fileID: 0} ---- !u!114 &340435494 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - m_PrefabInstance: {fileID: 1425865520} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 99a3543f95d09ec4baf755888dc99229, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1001 &341696946 PrefabInstance: m_ObjectHideFlags: 0 @@ -12311,16 +12263,6 @@ PrefabInstance: propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.data[0] - value: - objectReference: {fileID: 269210541} - target: {fileID: 1791521307550520026, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: m_LocalPosition.x @@ -12376,10 +12318,20 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.data[0] + value: + objectReference: {fileID: 269210541} - target: {fileID: 1791521307550520024, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: busy - value: 1 + value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} @@ -12919,18 +12871,6 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 747fe745ab83de54487cbc2fa5a45464, type: 3} ---- !u!114 &544785687 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - m_PrefabInstance: {fileID: 1348063382} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 99a3543f95d09ec4baf755888dc99229, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1001 &550676520 PrefabInstance: m_ObjectHideFlags: 0 @@ -14816,16 +14756,6 @@ PrefabInstance: propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.data[0] - value: - objectReference: {fileID: 1109010195} - target: {fileID: 1791521307550520026, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: m_LocalPosition.x @@ -14881,10 +14811,20 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.data[0] + value: + objectReference: {fileID: 1109010195} - target: {fileID: 1791521307550520024, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: busy - value: 1 + value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} @@ -15543,16 +15483,6 @@ PrefabInstance: propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.data[0] - value: - objectReference: {fileID: 1955153671} - target: {fileID: 1791521307550520026, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: m_LocalPosition.x @@ -15608,10 +15538,20 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.data[0] + value: + objectReference: {fileID: 1955153671} - target: {fileID: 1791521307550520024, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: busy - value: 1 + value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} @@ -16018,18 +15958,6 @@ Transform: type: 3} m_PrefabInstance: {fileID: 667775872} m_PrefabAsset: {fileID: 0} ---- !u!114 &668900332 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - m_PrefabInstance: {fileID: 536160957} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 99a3543f95d09ec4baf755888dc99229, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1001 &670261347 PrefabInstance: m_ObjectHideFlags: 0 @@ -16768,18 +16696,6 @@ Transform: type: 3} m_PrefabInstance: {fileID: 696611913} m_PrefabAsset: {fileID: 0} ---- !u!114 &697625470 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - m_PrefabInstance: {fileID: 1404958634} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 99a3543f95d09ec4baf755888dc99229, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!114 &699486102 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 2756454304486885374, guid: b0a1be4f616bc884c843e09ef23eedc2, @@ -19306,16 +19222,6 @@ PrefabInstance: propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.data[0] - value: - objectReference: {fileID: 1915515220} - target: {fileID: 1791521307550520026, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: m_LocalPosition.x @@ -19371,10 +19277,20 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.data[0] + value: + objectReference: {fileID: 1915515220} - target: {fileID: 1791521307550520024, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: busy - value: 1 + value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} @@ -21432,16 +21348,6 @@ PrefabInstance: propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.data[0] - value: - objectReference: {fileID: 1952716018} - target: {fileID: 1791521307550520026, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: m_LocalPosition.x @@ -21497,10 +21403,20 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.data[0] + value: + objectReference: {fileID: 1952716018} - target: {fileID: 1791521307550520024, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: busy - value: 1 + value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} @@ -22407,18 +22323,6 @@ Transform: type: 3} m_PrefabInstance: {fileID: 954695280} m_PrefabAsset: {fileID: 0} ---- !u!114 &954875324 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - m_PrefabInstance: {fileID: 926229747} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 99a3543f95d09ec4baf755888dc99229, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1001 &955263068 PrefabInstance: m_ObjectHideFlags: 0 @@ -22739,18 +22643,6 @@ Transform: type: 3} m_PrefabInstance: {fileID: 958420993} m_PrefabAsset: {fileID: 0} ---- !u!114 &958981018 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - m_PrefabInstance: {fileID: 1857649109} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 99a3543f95d09ec4baf755888dc99229, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!114 &960156939 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 2756454304486885374, guid: b0a1be4f616bc884c843e09ef23eedc2, @@ -22763,18 +22655,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 99a3543f95d09ec4baf755888dc99229, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &960605391 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - m_PrefabInstance: {fileID: 1681565704} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 99a3543f95d09ec4baf755888dc99229, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1 &962502116 GameObject: m_ObjectHideFlags: 0 @@ -27536,18 +27416,6 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 747fe745ab83de54487cbc2fa5a45464, type: 3} ---- !u!114 &1145074723 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - m_PrefabInstance: {fileID: 1270269600} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 99a3543f95d09ec4baf755888dc99229, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1001 &1153376123 PrefabInstance: m_ObjectHideFlags: 0 @@ -29694,16 +29562,6 @@ PrefabInstance: propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.data[0] - value: - objectReference: {fileID: 2096003524} - target: {fileID: 1791521307550520026, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: m_LocalPosition.x @@ -29759,10 +29617,20 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.data[0] + value: + objectReference: {fileID: 2096003524} - target: {fileID: 1791521307550520024, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: busy - value: 1 + value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} @@ -30901,16 +30769,6 @@ PrefabInstance: propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.data[0] - value: - objectReference: {fileID: 986562705} - target: {fileID: 1791521307550520026, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: m_LocalPosition.x @@ -30966,10 +30824,20 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.data[0] + value: + objectReference: {fileID: 986562705} - target: {fileID: 1791521307550520024, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: busy - value: 1 + value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} @@ -31069,7 +30937,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!4 &1319384764 Transform: m_ObjectHideFlags: 0 @@ -31504,16 +31372,6 @@ PrefabInstance: propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.data[0] - value: - objectReference: {fileID: 97793761} - target: {fileID: 1791521307550520026, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: m_LocalPosition.x @@ -31569,10 +31427,20 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.data[0] + value: + objectReference: {fileID: 97793761} - target: {fileID: 1791521307550520024, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: busy - value: 1 + value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} @@ -33049,16 +32917,6 @@ PrefabInstance: propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.data[0] - value: - objectReference: {fileID: 1347828790} - target: {fileID: 1791521307550520026, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: m_LocalPosition.x @@ -33114,10 +32972,20 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.data[0] + value: + objectReference: {fileID: 1347828790} - target: {fileID: 1791521307550520024, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: busy - value: 1 + value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} @@ -33355,7 +33223,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!4 &1416702820 Transform: m_ObjectHideFlags: 0 @@ -33732,16 +33600,6 @@ PrefabInstance: propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.data[0] - value: - objectReference: {fileID: 579615007} - target: {fileID: 1791521307550520026, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: m_LocalPosition.x @@ -33797,10 +33655,20 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.data[0] + value: + objectReference: {fileID: 579615007} - target: {fileID: 1791521307550520024, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: busy - value: 1 + value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} @@ -34723,16 +34591,6 @@ PrefabInstance: propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.data[0] - value: - objectReference: {fileID: 1634885450} - target: {fileID: 1791521307550520026, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: m_LocalPosition.x @@ -34788,10 +34646,20 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.data[0] + value: + objectReference: {fileID: 1634885450} - target: {fileID: 1791521307550520024, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: busy - value: 1 + value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} @@ -35628,16 +35496,6 @@ PrefabInstance: propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.data[0] - value: - objectReference: {fileID: 1487636918} - target: {fileID: 1791521307550520026, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: m_LocalPosition.x @@ -35693,10 +35551,20 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.data[0] + value: + objectReference: {fileID: 1487636918} - target: {fileID: 1791521307550520024, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: busy - value: 1 + value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} @@ -36809,28 +36677,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 847482b8a24761944afa5d77b34b5172, type: 3} m_Name: m_EditorClassIdentifier: - sourcesForCars: - - {fileID: 195149541} - - {fileID: 338249666} - - {fileID: 1735107795} - - {fileID: 2052684694} - - {fileID: 33173094} - - {fileID: 1145074723} - - {fileID: 1869453760} - - {fileID: 2039153730} - - {fileID: 668900332} - - {fileID: 960605391} - - {fileID: 340435494} - - {fileID: 1819666084} - - {fileID: 954875324} - - {fileID: 958981018} - - {fileID: 1853397777} - - {fileID: 2088018322} - - {fileID: 697625470} - - {fileID: 544785687} - destinationsForCars: - - {fileID: 1452865850} - - {fileID: 92966387} + sourcesForCars: [] + destinationsForCars: [] carPrefab: {fileID: 2116838705056311109, guid: 07a1dfd3f25855a4cb8aa445d748683a, type: 3} pedestrianPrefab: {fileID: 2230256534569483849, guid: 6fd728f6a50010945a0364fa323b4c67, @@ -36840,11 +36688,11 @@ MonoBehaviour: - {fileID: 980057523} - {fileID: 704651522} - {fileID: 932324545} - spawnTimeForCars: 0.1 - spawnTimeForPedestrians: 1 + spawnTimeForCars: 0.2 + spawnTimeForPedestrians: 1.5 carCounter: 0 pedestrianCounter: 0 - maxCarsOnScreen: 100 + maxCarsOnScreen: 200 maxPedestriansOnScreen: 2 --- !u!4 &1530260662 Transform: @@ -40327,16 +40175,6 @@ PrefabInstance: propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.data[0] - value: - objectReference: {fileID: 975169561} - target: {fileID: 1791521307550520026, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: m_LocalPosition.x @@ -40392,6 +40230,16 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.data[0] + value: + objectReference: {fileID: 975169561} - target: {fileID: 1791521307550520024, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: busy @@ -41626,18 +41474,6 @@ Transform: m_Father: {fileID: 635913326} m_RootOrder: 22 m_LocalEulerAnglesHint: {x: 0, y: 90, z: 0} ---- !u!114 &1735107795 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - m_PrefabInstance: {fileID: 1495505159} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 99a3543f95d09ec4baf755888dc99229, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1001 &1735154486 PrefabInstance: m_ObjectHideFlags: 0 @@ -43574,16 +43410,6 @@ PrefabInstance: propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.data[0] - value: - objectReference: {fileID: 1260584610} - target: {fileID: 1791521307550520026, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: m_LocalPosition.x @@ -43639,10 +43465,20 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.data[0] + value: + objectReference: {fileID: 1260584610} - target: {fileID: 1791521307550520024, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: busy - value: 1 + value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} @@ -43727,18 +43563,6 @@ Transform: type: 3} m_PrefabInstance: {fileID: 1815306853} m_PrefabAsset: {fileID: 0} ---- !u!114 &1819666084 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - m_PrefabInstance: {fileID: 837893415} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 99a3543f95d09ec4baf755888dc99229, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1001 &1820620697 PrefabInstance: m_ObjectHideFlags: 0 @@ -44319,16 +44143,6 @@ PrefabInstance: propertyPath: m_Name value: Source objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.data[0] - value: - objectReference: {fileID: 1281249260} - target: {fileID: 1791521307550520026, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: m_LocalPosition.x @@ -44384,6 +44198,16 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.data[0] + value: + objectReference: {fileID: 1281249260} - target: {fileID: 1791521307550520024, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: busy @@ -44472,18 +44296,6 @@ Transform: type: 3} m_PrefabInstance: {fileID: 1844695841} m_PrefabAsset: {fileID: 0} ---- !u!114 &1853397777 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - m_PrefabInstance: {fileID: 1843596946} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 99a3543f95d09ec4baf755888dc99229, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1001 &1855265900 PrefabInstance: m_ObjectHideFlags: 0 @@ -44576,16 +44388,6 @@ PrefabInstance: propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.data[0] - value: - objectReference: {fileID: 740946931} - target: {fileID: 1791521307550520026, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: m_LocalPosition.x @@ -44641,10 +44443,20 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.data[0] + value: + objectReference: {fileID: 740946931} - target: {fileID: 1791521307550520024, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: busy - value: 1 + value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} @@ -44978,18 +44790,6 @@ Transform: m_Father: {fileID: 635913326} m_RootOrder: 9 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &1869453760 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - m_PrefabInstance: {fileID: 638688625} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 99a3543f95d09ec4baf755888dc99229, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1001 &1871581133 PrefabInstance: m_ObjectHideFlags: 0 @@ -47381,16 +47181,6 @@ PrefabInstance: propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.data[0] - value: - objectReference: {fileID: 52006647} - target: {fileID: 1791521307550520026, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: m_LocalPosition.x @@ -47446,10 +47236,20 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.data[0] + value: + objectReference: {fileID: 52006647} - target: {fileID: 1791521307550520024, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: busy - value: 1 + value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} @@ -49505,18 +49305,6 @@ Transform: type: 3} m_PrefabInstance: {fileID: 2034665561} m_PrefabAsset: {fileID: 0} ---- !u!114 &2039153730 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - m_PrefabInstance: {fileID: 660123694} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 99a3543f95d09ec4baf755888dc99229, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1001 &2046286923 PrefabInstance: m_ObjectHideFlags: 0 @@ -49742,18 +49530,6 @@ Transform: type: 3} m_PrefabInstance: {fileID: 2051386515} m_PrefabAsset: {fileID: 0} ---- !u!114 &2052684694 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - m_PrefabInstance: {fileID: 1958870903} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 99a3543f95d09ec4baf755888dc99229, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1001 &2059541063 PrefabInstance: m_ObjectHideFlags: 0 @@ -50416,18 +50192,6 @@ Transform: type: 3} m_PrefabInstance: {fileID: 2079186612} m_PrefabAsset: {fileID: 0} ---- !u!114 &2088018322 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - m_PrefabInstance: {fileID: 1810934885} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 99a3543f95d09ec4baf755888dc99229, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1001 &2089418829 PrefabInstance: m_ObjectHideFlags: 0 @@ -51988,16 +51752,6 @@ PrefabInstance: propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, - type: 3} - propertyPath: neighbours.Array.data[0] - value: - objectReference: {fileID: 770917187} - target: {fileID: 1791521307550520026, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: m_LocalPosition.x @@ -52053,10 +51807,20 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1791521307550520022, guid: 317a31e9e24e8f2408538c895209a83f, + type: 3} + propertyPath: neighbours.Array.data[0] + value: + objectReference: {fileID: 770917187} - target: {fileID: 1791521307550520024, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} propertyPath: busy - value: 1 + value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 317a31e9e24e8f2408538c895209a83f, type: 3} diff --git a/Assets/Scripts/Cars/CarController.cs b/Assets/Scripts/Cars/CarController.cs index e6b3010..a377387 100644 --- a/Assets/Scripts/Cars/CarController.cs +++ b/Assets/Scripts/Cars/CarController.cs @@ -9,6 +9,7 @@ public class CarController : MonoBehaviour private const float laneDistance = 5f; public const float FastestCarVelocity = 14f; + public const float SlowestCarVelocity = 4f; public static int currentID = 0; public int ID; @@ -18,7 +19,7 @@ public class CarController : MonoBehaviour private void Awake() { ID = Interlocked.Increment(ref currentID); - maxVelocity = ID % 3 == 0 ? FastestCarVelocity : FastestCarVelocity - 10; + maxVelocity = ID % 3 == 0 ? FastestCarVelocity : SlowestCarVelocity; } public float maxVelocity = 4.33f; @@ -307,4 +308,4 @@ public void Destroy() OnDestroy.Invoke(); OnDestroy.RemoveAllListeners(); } -} +} \ No newline at end of file diff --git a/Assets/Scripts/Cars/DestinationForCars.cs b/Assets/Scripts/Cars/DestinationForCars.cs index a7d498d..2f4dfb9 100644 --- a/Assets/Scripts/Cars/DestinationForCars.cs +++ b/Assets/Scripts/Cars/DestinationForCars.cs @@ -2,6 +2,7 @@ public class DestinationForCars : MonoBehaviour { + public bool available = true; private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == Strings.car) @@ -9,4 +10,4 @@ private void OnTriggerEnter(Collider other) other.gameObject.GetComponent().Destroy(); } } -} +} \ No newline at end of file diff --git a/Assets/Scripts/Cars/DestinationForParking.cs b/Assets/Scripts/Cars/DestinationForParking.cs index 1b1ed7d..e343754 100644 --- a/Assets/Scripts/Cars/DestinationForParking.cs +++ b/Assets/Scripts/Cars/DestinationForParking.cs @@ -1,6 +1,6 @@ using UnityEngine; -public class DestinationForParking : MonoBehaviour +public class DestinationForParking : DestinationForCars { private void OnTriggerEnter(Collider other) { @@ -11,4 +11,4 @@ private void OnTriggerEnter(Collider other) other.GetComponentInChildren().gameObject.SetActive(false); } } -} +} \ No newline at end of file diff --git a/Assets/Scripts/Cars/DistanceSensor.cs b/Assets/Scripts/Cars/DistanceSensor.cs index 3f9b00f..d9a5eb3 100644 --- a/Assets/Scripts/Cars/DistanceSensor.cs +++ b/Assets/Scripts/Cars/DistanceSensor.cs @@ -31,7 +31,8 @@ private void Update() carIsInBrakingDistance = carRigidbody.velocity.magnitude > otherCar.GetComponent().velocity.magnitude || Vector3.Distance(car.transform.position, otherCar.transform.position) < 4; var otherController = otherCar.GetComponent(); - if (carController.maxVelocity > otherController.maxVelocity + 4) //TODO + if (carController.maxVelocity > otherController.maxVelocity + 4 + && otherController.maxVelocity > CarController.SlowestCarVelocity * 0.5) { if (carController.TryOvertake(otherController)) { diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index afe2e2e..87b4681 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -57,9 +57,24 @@ private void Awake() else { Instance = this; + Setup(); } } + private void Setup() + { + var path = GameObject.Find("/Path"); + + var destinations = path.GetComponentsInChildren(); + var sources = path.GetComponentsInChildren(); + + foreach (var dest in destinations) + if (dest.available) + destinationsForCars.Add(dest.gameObject.GetComponent()); + foreach (var source in sources) + sourcesForCars.Add(source.gameObject.GetComponent()); + } + private void Update() { currentSpawnTimeForCars += Time.deltaTime; @@ -89,7 +104,7 @@ private void SpawnCar() sources.Shuffle(); foreach (var source in sources) { - if (!source.GetComponent().busy) + if (!source.GetComponent().busy) { randomSource = source; break;