Browse Source

Perfomance fixes, bike lane fixes, custom start

Marcel Zickler 2 years ago
parent
commit
d0da7a826d

+ 7 - 3
Assembly-CSharp.csproj

@@ -64,12 +64,12 @@
     <Compile Include="Assets\AdvancedAnt\Plugins\Ant\Fit\Profile\Mesgs\TrainingFileMesg.cs" />
     <Compile Include="Assets\AdvancedAnt\Plugins\Ant\Fit\Profile\Types\CameraOrientationType.cs" />
     <Compile Include="Assets\AdvancedAnt\Plugins\Ant\Fit\Profile.cs" />
-    <Compile Include="Assets\Scripts\TrafficSimulation\PresetTrigger.cs" />
     <Compile Include="Assets\Wheels\Scripts\FreeCamera.cs" />
     <Compile Include="Assets\AdvancedAnt\Plugins\Ant\Fit\Accumulator.cs" />
     <Compile Include="Assets\AdvancedAnt\Plugins\Ant\Fit\Profile\Types\Language.cs" />
     <Compile Include="Assets\AdvancedAnt\Plugins\Ant\Fit\Profile\Types\ActivityType.cs" />
     <Compile Include="Assets\AdvancedAnt\Plugins\Ant\Fit\Profile\Types\DisplayPower.cs" />
+    <Compile Include="Assets\Scripts\Debugging\NonStaticObjectFinder.cs" />
     <Compile Include="Assets\AdvancedAnt\Plugins\Ant\Fit\Profile\Types\ActivityLevel.cs" />
     <Compile Include="Assets\AdvancedAnt\Plugins\Ant\Fit\BufferedMesgBroadcaster.cs" />
     <Compile Include="Assets\AdvancedAnt\Plugins\Ant\Fit\Profile\Types\SportBits5.cs" />
@@ -90,7 +90,9 @@
     <Compile Include="Assets\Scripts\Display\InFrontOfCameraDisplay.cs" />
     <Compile Include="Assets\AdvancedAnt\Plugins\Ant\Fit\Crc.cs" />
     <Compile Include="Assets\Scripts\Controller\Bicycle\BicycleControllerBaseBehaviour.cs" />
+    <Compile Include="Assets\SpawnWatcher.cs" />
     <Compile Include="Assets\Scripts\Controller\Bicycle\DummyBicycleController.cs" />
+    <Compile Include="Assets\Scripts\TrafficSimulation\IntersectionSituation\PresetTrigger.cs" />
     <Compile Include="Assets\AdvancedAnt\Plugins\Ant\Fit\IMesgBroadcastPlugin.cs" />
     <Compile Include="Assets\AdvancedAnt\Plugins\Ant\Fit\Profile\Types\DisplayPosition.cs" />
     <Compile Include="Assets\AdvancedAnt\Plugins\Ant\Fit\Profile\Mesgs\VideoDescriptionMesg.cs" />
@@ -166,6 +168,7 @@
     <Compile Include="Assets\Scripts\Routes\RouteManager.cs" />
     <Compile Include="Assets\Scripts\AdditionalMathf\Quartiles.cs" />
     <Compile Include="Assets\AdvancedAnt\Plugins\Ant\Fit\Profile\Types\SessionTrigger.cs" />
+    <Compile Include="Assets\Scripts\TrafficSimulation\IntersectionSituation\IntersectionPreset.cs" />
     <Compile Include="Assets\SuperCombiner\Scripts\Utils\CollidersHandler.cs" />
     <Compile Include="Assets\AdvancedAnt\Plugins\Ant\Fit\Profile\Mesgs\LengthMesg.cs" />
     <Compile Include="Assets\Scripts\Display\RbDebugDisplay.cs" />
@@ -219,6 +222,7 @@
     <Compile Include="Assets\Scripts\Tracking\KineticLegTracker.cs" />
     <Compile Include="Assets\SuperCombiner\Scripts\Utils\Logger.cs" />
     <Compile Include="Assets\AdvancedAnt\Plugins\Ant\Fit\Profile\Mesgs\EventMesg.cs" />
+    <Compile Include="Assets\Scripts\TrafficSimulation\IntersectionSituation\CarSituationSpawner.cs" />
     <Compile Include="Assets\SuperCombiner\Scripts\Utils\RendererObject.cs" />
     <Compile Include="Assets\AdvancedAnt\Plugins\Ant\Fit\Profile\Types\File.cs" />
     <Compile Include="Assets\AdvancedAnt\Scripts\FitnessEquipmentDisplay.cs" />
@@ -382,7 +386,6 @@
     <Compile Include="Assets\AdvancedAnt\Plugins\Ant\Fit\Profile\Types\DisplayHeart.cs" />
     <Compile Include="Assets\AdvancedAnt\Plugins\Ant\Fit\Profile\Mesgs\PadMesg.cs" />
     <Compile Include="Assets\SuperCombiner\Scripts\SuperCombiner.cs" />
-    <Compile Include="Assets\Scripts\TrafficSimulation\IntersectionPreset.cs" />
     <Compile Include="Assets\InputActions\InputMaster.cs" />
     <Compile Include="Assets\AdvancedAnt\Plugins\Ant\Fit\Profile\Types\LengthType.cs" />
     <Compile Include="Assets\Scripts\Roads\JunctionExtras.cs" />
@@ -399,7 +402,8 @@
     <Compile Include="Assets\Scripts\TrafficSimulation\RedLightStatus.cs" />
     <Compile Include="Assets\AdvancedAnt\Scripts\SpeedDisplay.cs" />
     <Compile Include="Assets\AdvancedAnt\Plugins\Ant\Fit\Mesg.cs" />
-    <Compile Include="Assets\Scripts\Debugging\NonStaticObjectFinder.cs" />
+    <Compile Include="Assets\EditorManipulator.cs" />
+    <Compile Include="Assets\InSightRenderHandler.cs" />
   </ItemGroup>
   <ItemGroup>
      <None Include="Assets\TextMesh Pro\Shaders\TMPro.cginc" />

+ 58 - 0
Assets/EditorManipulator.cs

@@ -0,0 +1,58 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEditor;
+using UnityEngine;
+
+[ExecuteInEditMode]
+public class EditorManipulator : MonoBehaviour
+{
+    public void SetEnableColliders(bool enabled)
+    {
+        Collider[] colls = GetComponentsInChildren<Collider>();
+
+        foreach(Collider c in colls)
+        {
+            c.enabled = enabled;
+        }
+
+        Debug.LogFormat("set {0} colliders", colls.Length);
+    }
+    public void SetEnableMeshRenderer(bool enabled)
+    {
+        MeshRenderer[] meshs = GetComponentsInChildren<MeshRenderer>();
+
+        foreach(MeshRenderer m in meshs)
+        {
+            m.enabled = enabled;
+        }
+        Debug.LogFormat("set {0} meshs", meshs.Length);
+    }
+}
+[CustomEditor(typeof(EditorManipulator))] //1
+public class EditorManipulatorEditor : Editor
+{
+    // OnInspector GUI
+    public override void OnInspectorGUI() //2
+    {
+        base.DrawDefaultInspector();
+        EditorManipulator script = (EditorManipulator)target;
+
+        if (GUILayout.Button("Enable colliders")) //8
+        {
+            script.SetEnableColliders(true);
+        }
+
+        if (GUILayout.Button("Disable colliders")) //8
+        {
+            script.SetEnableColliders(false);
+        }
+        if(GUILayout.Button("Enable Meshs"))
+        {
+            script.SetEnableMeshRenderer(true);
+        }
+        if(GUILayout.Button("Disable Meshs"))
+        {
+            script.SetEnableMeshRenderer(false);
+        }
+    }
+}

+ 11 - 0
Assets/EditorManipulator.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: a22152624aed4c84dab61f628f637e43
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 32 - 0
Assets/InSightRenderHandler.cs

@@ -0,0 +1,32 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class InSightRenderHandler : MonoBehaviour
+{
+    // Start is called before the first frame update
+    void Start()
+    {
+        
+    }
+
+    // Update is called once per frame
+    void Update()
+    {
+        
+    }
+    private void OnCollisionEnter(Collision collision)
+    {
+        if(collision.rigidbody.gameObject.tag != "bike" && collision.rigidbody.gameObject.tag != "AutonomousVehicle")
+        {
+            collision.rigidbody.gameObject.GetComponent<MeshRenderer>().enabled = true;
+        }
+    }
+    private void OnCollisionExit(Collision collision)
+    {
+        if (collision.rigidbody.gameObject.tag != "bike" && collision.rigidbody.gameObject.tag != "AutonomousVehicle")
+        {
+            collision.rigidbody.gameObject.GetComponent<MeshRenderer>().enabled = false;
+        }
+    }
+}

+ 11 - 0
Assets/InSightRenderHandler.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 67eec932fd60be5488f51ada81574241
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 236 - 74
Assets/Prefabs/Roads/Curve_Left.prefab

@@ -1,5 +1,86 @@
 %YAML 1.1
 %TAG !u! tag:unity3d.com,2011:
+--- !u!1 &2294793640300766631
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 6614818211299600504}
+  - component: {fileID: 1205806260980081418}
+  - component: {fileID: 7073785866158594321}
+  m_Layer: 0
+  m_Name: GameObject
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!4 &6614818211299600504
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 2294793640300766631}
+  m_LocalRotation: {x: -0, y: -1, z: -0, w: 0.0000007599591}
+  m_LocalPosition: {x: -5, y: 0.01999998, z: -5}
+  m_LocalScale: {x: 0.25, y: 1, z: 1}
+  m_Children: []
+  m_Father: {fileID: 7697091098573365820}
+  m_RootOrder: 1
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!33 &1205806260980081418
+MeshFilter:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 2294793640300766631}
+  m_Mesh: {fileID: 4300000, guid: 9aa786dd3f793a84a8a8852a66498c63, type: 3}
+--- !u!23 &7073785866158594321
+MeshRenderer:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 2294793640300766631}
+  m_Enabled: 1
+  m_CastShadows: 1
+  m_ReceiveShadows: 1
+  m_DynamicOccludee: 1
+  m_MotionVectors: 1
+  m_LightProbeUsage: 1
+  m_ReflectionProbeUsage: 1
+  m_RayTracingMode: 2
+  m_RayTraceProcedural: 0
+  m_RenderingLayerMask: 1
+  m_RendererPriority: 0
+  m_Materials:
+  - {fileID: 2100000, guid: 5ef4bf80a393edb4aade7b34e29bd181, type: 2}
+  m_StaticBatchInfo:
+    firstSubMesh: 0
+    subMeshCount: 0
+  m_StaticBatchRoot: {fileID: 0}
+  m_ProbeAnchor: {fileID: 0}
+  m_LightProbeVolumeOverride: {fileID: 0}
+  m_ScaleInLightmap: 1
+  m_ReceiveGI: 1
+  m_PreserveUVs: 0
+  m_IgnoreNormalsForChartDetection: 0
+  m_ImportantGI: 0
+  m_StitchLightmapSeams: 1
+  m_SelectedEditorRenderState: 3
+  m_MinimumChartSize: 4
+  m_AutoUVMaxDistance: 0.5
+  m_AutoUVMaxAngle: 89
+  m_LightmapParameters: {fileID: 0}
+  m_SortingLayerID: 0
+  m_SortingLayer: 0
+  m_SortingOrder: 0
+  m_AdditionalVertexStreams: {fileID: 0}
 --- !u!1 &6059761848495260345
 GameObject:
   m_ObjectHideFlags: 0
@@ -39,6 +120,87 @@ Transform:
   m_Father: {fileID: 0}
   m_RootOrder: 0
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1 &7838764925070752482
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 3374772897763681973}
+  - component: {fileID: 5993054386295398043}
+  - component: {fileID: 3800140124930401059}
+  m_Layer: 0
+  m_Name: GameObject
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!4 &3374772897763681973
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 7838764925070752482}
+  m_LocalRotation: {x: -0, y: 0.7071046, z: -0, w: 0.7071089}
+  m_LocalPosition: {x: 0, y: 0.01999998, z: -5}
+  m_LocalScale: {x: 0.25, y: 1, z: 1}
+  m_Children: []
+  m_Father: {fileID: 7697091098573365820}
+  m_RootOrder: 0
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!33 &5993054386295398043
+MeshFilter:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 7838764925070752482}
+  m_Mesh: {fileID: 4300000, guid: 9aa786dd3f793a84a8a8852a66498c63, type: 3}
+--- !u!23 &3800140124930401059
+MeshRenderer:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 7838764925070752482}
+  m_Enabled: 1
+  m_CastShadows: 1
+  m_ReceiveShadows: 1
+  m_DynamicOccludee: 1
+  m_MotionVectors: 1
+  m_LightProbeUsage: 1
+  m_ReflectionProbeUsage: 1
+  m_RayTracingMode: 2
+  m_RayTraceProcedural: 0
+  m_RenderingLayerMask: 1
+  m_RendererPriority: 0
+  m_Materials:
+  - {fileID: 2100000, guid: 5ef4bf80a393edb4aade7b34e29bd181, type: 2}
+  m_StaticBatchInfo:
+    firstSubMesh: 0
+    subMeshCount: 0
+  m_StaticBatchRoot: {fileID: 0}
+  m_ProbeAnchor: {fileID: 0}
+  m_LightProbeVolumeOverride: {fileID: 0}
+  m_ScaleInLightmap: 1
+  m_ReceiveGI: 1
+  m_PreserveUVs: 0
+  m_IgnoreNormalsForChartDetection: 0
+  m_ImportantGI: 0
+  m_StitchLightmapSeams: 1
+  m_SelectedEditorRenderState: 3
+  m_MinimumChartSize: 4
+  m_AutoUVMaxDistance: 0.5
+  m_AutoUVMaxAngle: 89
+  m_LightmapParameters: {fileID: 0}
+  m_SortingLayerID: 0
+  m_SortingLayer: 0
+  m_SortingOrder: 0
+  m_AdditionalVertexStreams: {fileID: 0}
 --- !u!1001 &79619316629966998
 PrefabInstance:
   m_ObjectHideFlags: 0
@@ -50,6 +212,10 @@ PrefabInstance:
       propertyPath: m_Name
       value: SM_Env_Sidewalk_Corner_02
       objectReference: {fileID: 0}
+    - target: {fileID: 419826, guid: 8458e1021e0b4a14b82c8e49978ee608, type: 3}
+      propertyPath: m_RootOrder
+      value: 1
+      objectReference: {fileID: 0}
     - target: {fileID: 419826, guid: 8458e1021e0b4a14b82c8e49978ee608, type: 3}
       propertyPath: m_LocalPosition.x
       value: -0.8100014
@@ -62,6 +228,10 @@ PrefabInstance:
       propertyPath: m_LocalPosition.z
       value: 0.92100525
       objectReference: {fileID: 0}
+    - target: {fileID: 419826, guid: 8458e1021e0b4a14b82c8e49978ee608, type: 3}
+      propertyPath: m_LocalRotation.w
+      value: 1
+      objectReference: {fileID: 0}
     - target: {fileID: 419826, guid: 8458e1021e0b4a14b82c8e49978ee608, type: 3}
       propertyPath: m_LocalRotation.x
       value: -0
@@ -74,14 +244,6 @@ PrefabInstance:
       propertyPath: m_LocalRotation.z
       value: -0
       objectReference: {fileID: 0}
-    - target: {fileID: 419826, guid: 8458e1021e0b4a14b82c8e49978ee608, type: 3}
-      propertyPath: m_LocalRotation.w
-      value: 1
-      objectReference: {fileID: 0}
-    - target: {fileID: 419826, guid: 8458e1021e0b4a14b82c8e49978ee608, type: 3}
-      propertyPath: m_RootOrder
-      value: 1
-      objectReference: {fileID: 0}
     - target: {fileID: 419826, guid: 8458e1021e0b4a14b82c8e49978ee608, type: 3}
       propertyPath: m_LocalEulerAnglesHint.x
       value: 0
@@ -119,6 +281,11 @@ PrefabInstance:
       propertyPath: m_Name
       value: SM_Env_Road_Curve_01
       objectReference: {fileID: 0}
+    - target: {fileID: 6507080286030546326, guid: 31b27a74537901a468e50e8e05397b7d,
+        type: 3}
+      propertyPath: m_RootOrder
+      value: 8
+      objectReference: {fileID: 0}
     - target: {fileID: 6507080286030546326, guid: 31b27a74537901a468e50e8e05397b7d,
         type: 3}
       propertyPath: m_LocalPosition.x
@@ -134,6 +301,11 @@ PrefabInstance:
       propertyPath: m_LocalPosition.z
       value: 10.921013
       objectReference: {fileID: 0}
+    - target: {fileID: 6507080286030546326, guid: 31b27a74537901a468e50e8e05397b7d,
+        type: 3}
+      propertyPath: m_LocalRotation.w
+      value: 1
+      objectReference: {fileID: 0}
     - target: {fileID: 6507080286030546326, guid: 31b27a74537901a468e50e8e05397b7d,
         type: 3}
       propertyPath: m_LocalRotation.x
@@ -149,16 +321,6 @@ PrefabInstance:
       propertyPath: m_LocalRotation.z
       value: -0
       objectReference: {fileID: 0}
-    - target: {fileID: 6507080286030546326, guid: 31b27a74537901a468e50e8e05397b7d,
-        type: 3}
-      propertyPath: m_LocalRotation.w
-      value: 1
-      objectReference: {fileID: 0}
-    - target: {fileID: 6507080286030546326, guid: 31b27a74537901a468e50e8e05397b7d,
-        type: 3}
-      propertyPath: m_RootOrder
-      value: 8
-      objectReference: {fileID: 0}
     - target: {fileID: 6507080286030546326, guid: 31b27a74537901a468e50e8e05397b7d,
         type: 3}
       propertyPath: m_LocalEulerAnglesHint.x
@@ -193,6 +355,10 @@ PrefabInstance:
       propertyPath: m_Name
       value: SM_Env_Road_15
       objectReference: {fileID: 0}
+    - target: {fileID: 489384, guid: 1ac8b9099f0c47e41a84ef1f2e41988c, type: 3}
+      propertyPath: m_RootOrder
+      value: 6
+      objectReference: {fileID: 0}
     - target: {fileID: 489384, guid: 1ac8b9099f0c47e41a84ef1f2e41988c, type: 3}
       propertyPath: m_LocalPosition.x
       value: 9.189789
@@ -205,6 +371,10 @@ PrefabInstance:
       propertyPath: m_LocalPosition.z
       value: 0.9210129
       objectReference: {fileID: 0}
+    - target: {fileID: 489384, guid: 1ac8b9099f0c47e41a84ef1f2e41988c, type: 3}
+      propertyPath: m_LocalRotation.w
+      value: 0.7071089
+      objectReference: {fileID: 0}
     - target: {fileID: 489384, guid: 1ac8b9099f0c47e41a84ef1f2e41988c, type: 3}
       propertyPath: m_LocalRotation.x
       value: -0
@@ -217,14 +387,6 @@ PrefabInstance:
       propertyPath: m_LocalRotation.z
       value: -0
       objectReference: {fileID: 0}
-    - target: {fileID: 489384, guid: 1ac8b9099f0c47e41a84ef1f2e41988c, type: 3}
-      propertyPath: m_LocalRotation.w
-      value: 0.7071089
-      objectReference: {fileID: 0}
-    - target: {fileID: 489384, guid: 1ac8b9099f0c47e41a84ef1f2e41988c, type: 3}
-      propertyPath: m_RootOrder
-      value: 6
-      objectReference: {fileID: 0}
     - target: {fileID: 489384, guid: 1ac8b9099f0c47e41a84ef1f2e41988c, type: 3}
       propertyPath: m_LocalEulerAnglesHint.x
       value: 0
@@ -260,6 +422,10 @@ PrefabInstance:
       propertyPath: m_Name
       value: SM_Env_Sidewalk_Straight_30
       objectReference: {fileID: 0}
+    - target: {fileID: 413058, guid: ae7b8255185ace64ca379cb1ca3b24e6, type: 3}
+      propertyPath: m_RootOrder
+      value: 5
+      objectReference: {fileID: 0}
     - target: {fileID: 413058, guid: ae7b8255185ace64ca379cb1ca3b24e6, type: 3}
       propertyPath: m_LocalPosition.x
       value: 4.189789
@@ -272,6 +438,10 @@ PrefabInstance:
       propertyPath: m_LocalPosition.z
       value: 0.9210129
       objectReference: {fileID: 0}
+    - target: {fileID: 413058, guid: ae7b8255185ace64ca379cb1ca3b24e6, type: 3}
+      propertyPath: m_LocalRotation.w
+      value: 1
+      objectReference: {fileID: 0}
     - target: {fileID: 413058, guid: ae7b8255185ace64ca379cb1ca3b24e6, type: 3}
       propertyPath: m_LocalRotation.x
       value: -0
@@ -284,14 +454,6 @@ PrefabInstance:
       propertyPath: m_LocalRotation.z
       value: -0
       objectReference: {fileID: 0}
-    - target: {fileID: 413058, guid: ae7b8255185ace64ca379cb1ca3b24e6, type: 3}
-      propertyPath: m_LocalRotation.w
-      value: 1
-      objectReference: {fileID: 0}
-    - target: {fileID: 413058, guid: ae7b8255185ace64ca379cb1ca3b24e6, type: 3}
-      propertyPath: m_RootOrder
-      value: 5
-      objectReference: {fileID: 0}
     - target: {fileID: 413058, guid: ae7b8255185ace64ca379cb1ca3b24e6, type: 3}
       propertyPath: m_LocalEulerAnglesHint.x
       value: 0
@@ -323,6 +485,10 @@ PrefabInstance:
       propertyPath: m_Name
       value: SM_Env_Road_14
       objectReference: {fileID: 0}
+    - target: {fileID: 489384, guid: 1ac8b9099f0c47e41a84ef1f2e41988c, type: 3}
+      propertyPath: m_RootOrder
+      value: 7
+      objectReference: {fileID: 0}
     - target: {fileID: 489384, guid: 1ac8b9099f0c47e41a84ef1f2e41988c, type: 3}
       propertyPath: m_LocalPosition.x
       value: -0.81
@@ -335,6 +501,10 @@ PrefabInstance:
       propertyPath: m_LocalPosition.z
       value: 5.921
       objectReference: {fileID: 0}
+    - target: {fileID: 489384, guid: 1ac8b9099f0c47e41a84ef1f2e41988c, type: 3}
+      propertyPath: m_LocalRotation.w
+      value: 0.0000007599591
+      objectReference: {fileID: 0}
     - target: {fileID: 489384, guid: 1ac8b9099f0c47e41a84ef1f2e41988c, type: 3}
       propertyPath: m_LocalRotation.x
       value: -0
@@ -347,14 +517,6 @@ PrefabInstance:
       propertyPath: m_LocalRotation.z
       value: -0
       objectReference: {fileID: 0}
-    - target: {fileID: 489384, guid: 1ac8b9099f0c47e41a84ef1f2e41988c, type: 3}
-      propertyPath: m_LocalRotation.w
-      value: 0.0000007599591
-      objectReference: {fileID: 0}
-    - target: {fileID: 489384, guid: 1ac8b9099f0c47e41a84ef1f2e41988c, type: 3}
-      propertyPath: m_RootOrder
-      value: 7
-      objectReference: {fileID: 0}
     - target: {fileID: 489384, guid: 1ac8b9099f0c47e41a84ef1f2e41988c, type: 3}
       propertyPath: m_LocalEulerAnglesHint.x
       value: 0
@@ -390,6 +552,10 @@ PrefabInstance:
       propertyPath: m_Name
       value: SM_Env_Sidewalk_Straight_30 (2)
       objectReference: {fileID: 0}
+    - target: {fileID: 413058, guid: ae7b8255185ace64ca379cb1ca3b24e6, type: 3}
+      propertyPath: m_RootOrder
+      value: 3
+      objectReference: {fileID: 0}
     - target: {fileID: 413058, guid: ae7b8255185ace64ca379cb1ca3b24e6, type: 3}
       propertyPath: m_LocalPosition.x
       value: -0.810009
@@ -402,6 +568,10 @@ PrefabInstance:
       propertyPath: m_LocalPosition.z
       value: 0.9210129
       objectReference: {fileID: 0}
+    - target: {fileID: 413058, guid: ae7b8255185ace64ca379cb1ca3b24e6, type: 3}
+      propertyPath: m_LocalRotation.w
+      value: 0.7071068
+      objectReference: {fileID: 0}
     - target: {fileID: 413058, guid: ae7b8255185ace64ca379cb1ca3b24e6, type: 3}
       propertyPath: m_LocalRotation.x
       value: -0
@@ -414,14 +584,6 @@ PrefabInstance:
       propertyPath: m_LocalRotation.z
       value: -0
       objectReference: {fileID: 0}
-    - target: {fileID: 413058, guid: ae7b8255185ace64ca379cb1ca3b24e6, type: 3}
-      propertyPath: m_LocalRotation.w
-      value: 0.7071068
-      objectReference: {fileID: 0}
-    - target: {fileID: 413058, guid: ae7b8255185ace64ca379cb1ca3b24e6, type: 3}
-      propertyPath: m_RootOrder
-      value: 3
-      objectReference: {fileID: 0}
     - target: {fileID: 413058, guid: ae7b8255185ace64ca379cb1ca3b24e6, type: 3}
       propertyPath: m_LocalEulerAnglesHint.x
       value: 0
@@ -453,6 +615,10 @@ PrefabInstance:
       propertyPath: m_Name
       value: SM_Env_Sidewalk_Straight_30 (3)
       objectReference: {fileID: 0}
+    - target: {fileID: 413058, guid: ae7b8255185ace64ca379cb1ca3b24e6, type: 3}
+      propertyPath: m_RootOrder
+      value: 2
+      objectReference: {fileID: 0}
     - target: {fileID: 413058, guid: ae7b8255185ace64ca379cb1ca3b24e6, type: 3}
       propertyPath: m_LocalPosition.x
       value: -0.810009
@@ -465,6 +631,10 @@ PrefabInstance:
       propertyPath: m_LocalPosition.z
       value: 5.921013
       objectReference: {fileID: 0}
+    - target: {fileID: 413058, guid: ae7b8255185ace64ca379cb1ca3b24e6, type: 3}
+      propertyPath: m_LocalRotation.w
+      value: 0.7071068
+      objectReference: {fileID: 0}
     - target: {fileID: 413058, guid: ae7b8255185ace64ca379cb1ca3b24e6, type: 3}
       propertyPath: m_LocalRotation.x
       value: -0
@@ -477,14 +647,6 @@ PrefabInstance:
       propertyPath: m_LocalRotation.z
       value: -0
       objectReference: {fileID: 0}
-    - target: {fileID: 413058, guid: ae7b8255185ace64ca379cb1ca3b24e6, type: 3}
-      propertyPath: m_LocalRotation.w
-      value: 0.7071068
-      objectReference: {fileID: 0}
-    - target: {fileID: 413058, guid: ae7b8255185ace64ca379cb1ca3b24e6, type: 3}
-      propertyPath: m_RootOrder
-      value: 2
-      objectReference: {fileID: 0}
     - target: {fileID: 413058, guid: ae7b8255185ace64ca379cb1ca3b24e6, type: 3}
       propertyPath: m_LocalEulerAnglesHint.x
       value: 0
@@ -516,6 +678,10 @@ PrefabInstance:
       propertyPath: m_Name
       value: SM_Env_Road_Bare_01
       objectReference: {fileID: 0}
+    - target: {fileID: 493038, guid: dab5db0c0226560499e1021898aafb64, type: 3}
+      propertyPath: m_RootOrder
+      value: 0
+      objectReference: {fileID: 0}
     - target: {fileID: 493038, guid: dab5db0c0226560499e1021898aafb64, type: 3}
       propertyPath: m_LocalPosition.x
       value: 4.1899986
@@ -528,6 +694,10 @@ PrefabInstance:
       propertyPath: m_LocalPosition.z
       value: 5.9210052
       objectReference: {fileID: 0}
+    - target: {fileID: 493038, guid: dab5db0c0226560499e1021898aafb64, type: 3}
+      propertyPath: m_LocalRotation.w
+      value: 1
+      objectReference: {fileID: 0}
     - target: {fileID: 493038, guid: dab5db0c0226560499e1021898aafb64, type: 3}
       propertyPath: m_LocalRotation.x
       value: -0
@@ -540,14 +710,6 @@ PrefabInstance:
       propertyPath: m_LocalRotation.z
       value: -0
       objectReference: {fileID: 0}
-    - target: {fileID: 493038, guid: dab5db0c0226560499e1021898aafb64, type: 3}
-      propertyPath: m_LocalRotation.w
-      value: 1
-      objectReference: {fileID: 0}
-    - target: {fileID: 493038, guid: dab5db0c0226560499e1021898aafb64, type: 3}
-      propertyPath: m_RootOrder
-      value: 0
-      objectReference: {fileID: 0}
     - target: {fileID: 493038, guid: dab5db0c0226560499e1021898aafb64, type: 3}
       propertyPath: m_LocalEulerAnglesHint.x
       value: 0
@@ -579,6 +741,10 @@ PrefabInstance:
       propertyPath: m_Name
       value: SM_Env_Sidewalk_Straight_30 (1)
       objectReference: {fileID: 0}
+    - target: {fileID: 413058, guid: ae7b8255185ace64ca379cb1ca3b24e6, type: 3}
+      propertyPath: m_RootOrder
+      value: 4
+      objectReference: {fileID: 0}
     - target: {fileID: 413058, guid: ae7b8255185ace64ca379cb1ca3b24e6, type: 3}
       propertyPath: m_LocalPosition.x
       value: 9.189789
@@ -591,6 +757,10 @@ PrefabInstance:
       propertyPath: m_LocalPosition.z
       value: 0.9210129
       objectReference: {fileID: 0}
+    - target: {fileID: 413058, guid: ae7b8255185ace64ca379cb1ca3b24e6, type: 3}
+      propertyPath: m_LocalRotation.w
+      value: 1
+      objectReference: {fileID: 0}
     - target: {fileID: 413058, guid: ae7b8255185ace64ca379cb1ca3b24e6, type: 3}
       propertyPath: m_LocalRotation.x
       value: -0
@@ -603,14 +773,6 @@ PrefabInstance:
       propertyPath: m_LocalRotation.z
       value: -0
       objectReference: {fileID: 0}
-    - target: {fileID: 413058, guid: ae7b8255185ace64ca379cb1ca3b24e6, type: 3}
-      propertyPath: m_LocalRotation.w
-      value: 1
-      objectReference: {fileID: 0}
-    - target: {fileID: 413058, guid: ae7b8255185ace64ca379cb1ca3b24e6, type: 3}
-      propertyPath: m_RootOrder
-      value: 4
-      objectReference: {fileID: 0}
     - target: {fileID: 413058, guid: ae7b8255185ace64ca379cb1ca3b24e6, type: 3}
       propertyPath: m_LocalEulerAnglesHint.x
       value: 0

BIN
Assets/Scenes/MainScene.unity


+ 1 - 0
Assets/Scripts/Routes/Route.cs

@@ -41,6 +41,7 @@ namespace Routes
 
         public List<RouteItem> items;
 
+        public Transform customStartTransform;
         public StraightRoadExtras start;
         public StraightRoadExtras finish;
 

+ 23 - 15
Assets/Scripts/Routes/RouteManager.cs

@@ -27,25 +27,33 @@ namespace Routes
 
         private void PlaceBike()
         {
-            var firstTurnPos = routes[selectedRoute].items.First().turn.transform.position;
+            if(routes[selectedRoute].customStartTransform != null)
+            {
+                bicycle.gameObject.transform.position = routes[selectedRoute].customStartTransform.position;
+                bicycle.gameObject.transform.rotation = routes[selectedRoute].customStartTransform.rotation;
+            }
+            else
+            {
+                var firstTurnPos = routes[selectedRoute].items.First().turn.transform.position;
 
-            var startTransform = routes[selectedRoute].start.gameObject.transform;
+                var startTransform = routes[selectedRoute].start.gameObject.transform;
 
-            var difStartFirstTurn = firstTurnPos - startTransform.position;
-            var bikeDirection = Vector3.zero;
+                var difStartFirstTurn = firstTurnPos - startTransform.position;
+                var bikeDirection = Vector3.zero;
 
-            if (difStartFirstTurn.x > 1)
-                bikeDirection = new Vector3(-1, 0, 0);
-            else if (difStartFirstTurn.z > 1)
-                bikeDirection = new Vector3(0, 0, -1);
-            else if (difStartFirstTurn.x < -1)
-                bikeDirection = new Vector3(1, 0, 0);
-            else if (difStartFirstTurn.z < -1) bikeDirection = new Vector3(0, 0, 1);
+                if (difStartFirstTurn.x > 1)
+                    bikeDirection = new Vector3(-1, 0, 0);
+                else if (difStartFirstTurn.z > 1)
+                    bikeDirection = new Vector3(0, 0, -1);
+                else if (difStartFirstTurn.x < -1)
+                    bikeDirection = new Vector3(1, 0, 0);
+                else if (difStartFirstTurn.z < -1) bikeDirection = new Vector3(0, 0, 1);
 
-            bicycleGameObject = bicycle.gameObject;
-            bicycleGameObject.transform.position =
-                startTransform.position + bikeDirection * 12;
-            bicycleGameObject.transform.LookAt(startTransform);
+                bicycleGameObject = bicycle.gameObject;
+                bicycleGameObject.transform.position =
+                    startTransform.position + bikeDirection * 12;
+                bicycleGameObject.transform.LookAt(startTransform);
+            }
         }
 
         private void OnFinishPassed()