Browse Source

Start + Finish Line

Marcel Zickler 3 years ago
parent
commit
35c175c205

+ 2 - 0
Assets/Editor/RouteEditor.cs

@@ -33,6 +33,8 @@ public class RoutesEditor : Editor
     public override void OnInspectorGUI()
     {
         serializedObject.Update();
+        EditorGUILayout.PropertyField(serializedObject.FindProperty("start"));
+        EditorGUILayout.PropertyField(serializedObject.FindProperty("finish"));
         RoutesList(serializedObject.FindProperty("items"));
         //EditorGUILayout.PropertyField(routes.FindPropertyRelative("arraySize"), true);true);
         serializedObject.ApplyModifiedProperties();

BIN
Assets/Models/Route/Arc.fbx


+ 97 - 0
Assets/Models/Route/Arc.fbx.meta

@@ -0,0 +1,97 @@
+fileFormatVersion: 2
+guid: 2b457a924376293439c8986334ea6d08
+ModelImporter:
+  serializedVersion: 19301
+  internalIDToNameTable: []
+  externalObjects: {}
+  materials:
+    materialImportMode: 1
+    materialName: 0
+    materialSearch: 1
+    materialLocation: 1
+  animations:
+    legacyGenerateAnimations: 4
+    bakeSimulation: 0
+    resampleCurves: 1
+    optimizeGameObjects: 0
+    motionNodeName: 
+    rigImportErrors: 
+    rigImportWarnings: 
+    animationImportErrors: 
+    animationImportWarnings: 
+    animationRetargetingWarnings: 
+    animationDoRetargetingWarnings: 0
+    importAnimatedCustomProperties: 0
+    importConstraints: 0
+    animationCompression: 1
+    animationRotationError: 0.5
+    animationPositionError: 0.5
+    animationScaleError: 0.5
+    animationWrapMode: 0
+    extraExposedTransformPaths: []
+    extraUserProperties: []
+    clipAnimations: []
+    isReadable: 0
+  meshes:
+    lODScreenPercentages: []
+    globalScale: 1
+    meshCompression: 0
+    addColliders: 0
+    useSRGBMaterialColor: 1
+    sortHierarchyByName: 1
+    importVisibility: 1
+    importBlendShapes: 1
+    importCameras: 1
+    importLights: 1
+    fileIdsGeneration: 2
+    swapUVChannels: 0
+    generateSecondaryUV: 0
+    useFileUnits: 1
+    keepQuads: 0
+    weldVertices: 1
+    preserveHierarchy: 0
+    skinWeightsMode: 0
+    maxBonesPerVertex: 4
+    minBoneWeight: 0.001
+    meshOptimizationFlags: -1
+    indexFormat: 0
+    secondaryUVAngleDistortion: 8
+    secondaryUVAreaDistortion: 15.000001
+    secondaryUVHardAngle: 88
+    secondaryUVPackMargin: 4
+    useFileScale: 1
+  tangentSpace:
+    normalSmoothAngle: 60
+    normalImportMode: 0
+    tangentImportMode: 3
+    normalCalculationMode: 4
+    legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
+    blendShapeNormalImportMode: 1
+    normalSmoothingSource: 0
+  referencedClips: []
+  importAnimation: 1
+  humanDescription:
+    serializedVersion: 3
+    human: []
+    skeleton: []
+    armTwist: 0.5
+    foreArmTwist: 0.5
+    upperLegTwist: 0.5
+    legTwist: 0.5
+    armStretch: 0.05
+    legStretch: 0.05
+    feetSpacing: 0
+    globalScale: 1
+    rootMotionBoneName: 
+    hasTranslationDoF: 0
+    hasExtraRoot: 0
+    skeletonHasParents: 1
+  lastHumanDescriptionAvatarSource: {instanceID: 0}
+  autoGenerateAvatarMappingIfUnspecified: 1
+  animationType: 2
+  humanoidOversampling: 1
+  avatarSetup: 0
+  additionalBone: 0
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 8 - 0
Assets/Models/Route/incrementalSave.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 432f6995b6d23bc40b173707f6c88726
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 8 - 0
Assets/Models/Route/incrementalSave/StartArc.fbx.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 341e9f74c3e9ab6428de7d68248919e1
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

File diff suppressed because it is too large
+ 274 - 0
Assets/Models/Route/incrementalSave/StartArc.fbx/StartArc.0001.fbx


+ 97 - 0
Assets/Models/Route/incrementalSave/StartArc.fbx/StartArc.0001.fbx.meta

@@ -0,0 +1,97 @@
+fileFormatVersion: 2
+guid: e5707ecce5f336e41b753041d6cb110f
+ModelImporter:
+  serializedVersion: 19301
+  internalIDToNameTable: []
+  externalObjects: {}
+  materials:
+    materialImportMode: 1
+    materialName: 0
+    materialSearch: 1
+    materialLocation: 1
+  animations:
+    legacyGenerateAnimations: 4
+    bakeSimulation: 0
+    resampleCurves: 1
+    optimizeGameObjects: 0
+    motionNodeName: 
+    rigImportErrors: 
+    rigImportWarnings: 
+    animationImportErrors: 
+    animationImportWarnings: 
+    animationRetargetingWarnings: 
+    animationDoRetargetingWarnings: 0
+    importAnimatedCustomProperties: 0
+    importConstraints: 0
+    animationCompression: 1
+    animationRotationError: 0.5
+    animationPositionError: 0.5
+    animationScaleError: 0.5
+    animationWrapMode: 0
+    extraExposedTransformPaths: []
+    extraUserProperties: []
+    clipAnimations: []
+    isReadable: 0
+  meshes:
+    lODScreenPercentages: []
+    globalScale: 1
+    meshCompression: 0
+    addColliders: 0
+    useSRGBMaterialColor: 1
+    sortHierarchyByName: 1
+    importVisibility: 1
+    importBlendShapes: 1
+    importCameras: 1
+    importLights: 1
+    fileIdsGeneration: 2
+    swapUVChannels: 0
+    generateSecondaryUV: 0
+    useFileUnits: 1
+    keepQuads: 0
+    weldVertices: 1
+    preserveHierarchy: 0
+    skinWeightsMode: 0
+    maxBonesPerVertex: 4
+    minBoneWeight: 0.001
+    meshOptimizationFlags: -1
+    indexFormat: 0
+    secondaryUVAngleDistortion: 8
+    secondaryUVAreaDistortion: 15.000001
+    secondaryUVHardAngle: 88
+    secondaryUVPackMargin: 4
+    useFileScale: 1
+  tangentSpace:
+    normalSmoothAngle: 60
+    normalImportMode: 0
+    tangentImportMode: 3
+    normalCalculationMode: 4
+    legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
+    blendShapeNormalImportMode: 1
+    normalSmoothingSource: 0
+  referencedClips: []
+  importAnimation: 1
+  humanDescription:
+    serializedVersion: 3
+    human: []
+    skeleton: []
+    armTwist: 0.5
+    foreArmTwist: 0.5
+    upperLegTwist: 0.5
+    legTwist: 0.5
+    armStretch: 0.05
+    legStretch: 0.05
+    feetSpacing: 0
+    globalScale: 1
+    rootMotionBoneName: 
+    hasTranslationDoF: 0
+    hasExtraRoot: 0
+    skeletonHasParents: 1
+  lastHumanDescriptionAvatarSource: {instanceID: 0}
+  autoGenerateAvatarMappingIfUnspecified: 1
+  animationType: 2
+  humanoidOversampling: 1
+  avatarSetup: 0
+  additionalBone: 0
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 16 - 2
Assets/Prefabs/Roads/Road_Straight_With_Sidewalk.prefab

@@ -10,6 +10,7 @@ GameObject:
   m_Component:
   - component: {fileID: 1121772855208284805}
   - component: {fileID: 6005517995662966679}
+  - component: {fileID: 9061039248718032557}
   m_Layer: 0
   m_Name: Road_Straight_With_Sidewalk
   m_TagString: Untagged
@@ -47,8 +48,21 @@ MonoBehaviour:
   m_Script: {fileID: 11500000, guid: 84b90430bf93c0444947fd007b73c3b5, type: 3}
   m_Name: 
   m_EditorClassIdentifier: 
-  CoinPool: {fileID: 0}
-  hasCoin: 0
+  arcPrefab: {fileID: 5979153780898274881, guid: 59286994332b18945a559c5dcd7901e8,
+    type: 3}
+--- !u!65 &9061039248718032557
+BoxCollider:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 5454143873828192637}
+  m_Material: {fileID: 0}
+  m_IsTrigger: 1
+  m_Enabled: 1
+  serializedVersion: 2
+  m_Size: {x: 5, y: 6, z: 20}
+  m_Center: {x: 2.5, y: 3, z: 0}
 --- !u!1001 &1009265090087214522
 PrefabInstance:
   m_ObjectHideFlags: 0

+ 81 - 0
Assets/Prefabs/Routes/Arc.prefab

@@ -0,0 +1,81 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!1 &5979153780898274881
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 6463202043414725883}
+  - component: {fileID: 7934836315283999582}
+  - component: {fileID: 5330789573038423956}
+  m_Layer: 0
+  m_Name: Arc
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!4 &6463202043414725883
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 5979153780898274881}
+  m_LocalRotation: {x: 0, y: -0, z: -0, w: 1}
+  m_LocalPosition: {x: 0, y: -4.5, z: 0}
+  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_Children: []
+  m_Father: {fileID: 0}
+  m_RootOrder: 0
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!33 &7934836315283999582
+MeshFilter:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 5979153780898274881}
+  m_Mesh: {fileID: -1226817584057097758, guid: 2b457a924376293439c8986334ea6d08, type: 3}
+--- !u!23 &5330789573038423956
+MeshRenderer:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 5979153780898274881}
+  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_RenderingLayerMask: 1
+  m_RendererPriority: 0
+  m_Materials:
+  - {fileID: 2100000, guid: 5630177b16d8bdf479f22ed9cd2b7554, 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

+ 7 - 0
Assets/Prefabs/Routes/Arc.prefab.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 59286994332b18945a559c5dcd7901e8
+PrefabImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

File diff suppressed because it is too large
+ 132 - 106
Assets/Scenes/MainScene.unity


+ 20 - 4
Assets/Scripts/Roads/StraightRoadExtras.cs

@@ -1,12 +1,28 @@
-using Pools;
+using System;
+using Pools;
 using UnityEngine;
 
 namespace Roads
 {
    public class StraightRoadExtras : MonoBehaviour
    {
-      public Pool coinPool;
-      public bool hasCoin = false;
-      //TODO: maybe hasCheckpoint or hasBarrier ?
+      public GameObject arcPrefab;
+      private GameObject arc;
+
+      private bool hasArc;
+
+      public void ShowArc()
+      {
+         arc = Instantiate(arcPrefab, transform);
+         hasArc = arc != null;
+      }
+
+      private void OnTriggerExit(Collider other)
+      {
+         if (hasArc && other.CompareTag("bike"))
+         {
+            Destroy(arc);
+         }
+      }
    }
 }

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

@@ -39,6 +39,9 @@ namespace Routes
     {
         public List<RouteItem> items;
 
+        public StraightRoadExtras start;
+        public StraightRoadExtras finish;
+
         private int visibleLength;
         private int visibleStart;
 
@@ -48,6 +51,8 @@ namespace Routes
 
         private void Start()
         {
+            start.ShowArc();
+            
             var routeManager = GetComponentInParent<RouteManager>();
             visibleStart = 0;
             visibleLength = routeManager.visibleLength;
@@ -65,6 +70,11 @@ namespace Routes
 
         private void UpdateRouteItems()
         {
+            if (VisibleEnd == items.Count - 1)
+            {
+                finish.ShowArc();
+            }
+            
             for (var i = 0; i < VisibleEnd; i++)
             {
                 var item = items[i];

+ 2 - 3
Assets/Scripts/Routes/Turn.cs

@@ -37,6 +37,7 @@ namespace Routes
         private List<GameObject> usedArrows = new List<GameObject>();
 
         private Collider trigger;
+        private static readonly RoadDirection[] allDirections = {RoadDirection.West, RoadDirection.North, RoadDirection.East, RoadDirection.South};
         public Action OnTriggerExitBicycle { get; set; }
 
         private void Awake()
@@ -145,10 +146,8 @@ namespace Routes
 
             turnDirection = TurnDirectionMapper.GetTurnDirection(comingFrom, goingTo);
 
-            var items = new[] {RoadDirection.West, RoadDirection.North, RoadDirection.East, RoadDirection.South};
-
             var usedArrowIndex = 0;
-            foreach (var position in items.Where(i => i != comingFrom && i != goingTo))
+            foreach (var position in allDirections.Where(i => i != comingFrom && i != goingTo))
             {
                 GameObject arrows;
                 if (usedArrowIndex < usedArrows.Count)

+ 1 - 1
ProjectSettings/QualitySettings.asset

@@ -95,7 +95,7 @@ QualitySettings:
     skinWeights: 2
     textureQuality: 0
     anisotropicTextures: 1
-    antiAliasing: 0
+    antiAliasing: 2
     softParticles: 0
     softVegetation: 1
     realtimeReflectionProbes: 1

Some files were not shown because too many files changed in this diff