obstacle traffic
This commit is contained in:
parent
51902ad0a8
commit
638ae2fb02
164
Assets/Prefabs/Sci Fi Van_LowPoly.prefab
Normal file
164
Assets/Prefabs/Sci Fi Van_LowPoly.prefab
Normal file
|
|
@ -0,0 +1,164 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1001 &2125560124640956769
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: -8679921383154817045, guid: fa4cdce30f7553a41ab78389fb3a80a5,
|
||||
type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 48.26251
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: fa4cdce30f7553a41ab78389fb3a80a5,
|
||||
type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 48.26251
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: fa4cdce30f7553a41ab78389fb3a80a5,
|
||||
type: 3}
|
||||
propertyPath: m_LocalScale.z
|
||||
value: 48.26251
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: fa4cdce30f7553a41ab78389fb3a80a5,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: -1.679
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: fa4cdce30f7553a41ab78389fb3a80a5,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: -0.02
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: fa4cdce30f7553a41ab78389fb3a80a5,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: -10.459591
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: fa4cdce30f7553a41ab78389fb3a80a5,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 0.7071068
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: fa4cdce30f7553a41ab78389fb3a80a5,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: fa4cdce30f7553a41ab78389fb3a80a5,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: -0.7071068
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: fa4cdce30f7553a41ab78389fb3a80a5,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: fa4cdce30f7553a41ab78389fb3a80a5,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: fa4cdce30f7553a41ab78389fb3a80a5,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: -90
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: fa4cdce30f7553a41ab78389fb3a80a5,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 919132149155446097, guid: fa4cdce30f7553a41ab78389fb3a80a5,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Sci Fi Van_LowPoly
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents:
|
||||
- targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: fa4cdce30f7553a41ab78389fb3a80a5,
|
||||
type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 7780938528100787519}
|
||||
- targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: fa4cdce30f7553a41ab78389fb3a80a5,
|
||||
type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 8755992966562768256}
|
||||
- targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: fa4cdce30f7553a41ab78389fb3a80a5,
|
||||
type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 834029315997859246}
|
||||
m_SourcePrefab: {fileID: 100100000, guid: fa4cdce30f7553a41ab78389fb3a80a5, type: 3}
|
||||
--- !u!1 &1278714955272072240 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: fa4cdce30f7553a41ab78389fb3a80a5,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 2125560124640956769}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &7780938528100787519
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1278714955272072240}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 843f3385775543448a5ac7f3f452567d, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
speed: -10
|
||||
--- !u!65 &8755992966562768256
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1278714955272072240}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Size: {x: 0.09739569, y: 0.05914434, z: 0.065}
|
||||
m_Center: {x: 0, y: 0.03084423, z: 0}
|
||||
--- !u!54 &834029315997859246
|
||||
Rigidbody:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1278714955272072240}
|
||||
serializedVersion: 4
|
||||
m_Mass: 1
|
||||
m_Drag: 0
|
||||
m_AngularDrag: 0.05
|
||||
m_CenterOfMass: {x: 0, y: 0, z: 0}
|
||||
m_InertiaTensor: {x: 1, y: 1, z: 1}
|
||||
m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ImplicitCom: 1
|
||||
m_ImplicitTensor: 1
|
||||
m_UseGravity: 0
|
||||
m_IsKinematic: 1
|
||||
m_Interpolate: 0
|
||||
m_Constraints: 0
|
||||
m_CollisionDetection: 0
|
||||
7
Assets/Prefabs/Sci Fi Van_LowPoly.prefab.meta
Normal file
7
Assets/Prefabs/Sci Fi Van_LowPoly.prefab.meta
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2cd19f7ca8acca0588c2ffcfee899097
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -238,6 +238,7 @@ GameObject:
|
|||
- component: {fileID: 213155849}
|
||||
- component: {fileID: 213155848}
|
||||
- component: {fileID: 213155850}
|
||||
- component: {fileID: 213155851}
|
||||
m_Layer: 5
|
||||
m_Name: hearts_panel
|
||||
m_TagString: Untagged
|
||||
|
|
@ -331,6 +332,19 @@ MonoBehaviour:
|
|||
m_ChildScaleWidth: 0
|
||||
m_ChildScaleHeight: 0
|
||||
m_ReverseArrangement: 0
|
||||
--- !u!114 &213155851
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 213155846}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 86fd14087ffbc3b10920219500440647, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
livesParent: {fileID: 213155847}
|
||||
--- !u!1 &217970951
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -1095,8 +1109,156 @@ Transform:
|
|||
- {fileID: 414746046}
|
||||
- {fileID: 12566129}
|
||||
- {fileID: 1738485065}
|
||||
- {fileID: 590786744}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &590786743
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 590786744}
|
||||
- component: {fileID: 590786748}
|
||||
- component: {fileID: 590786747}
|
||||
- component: {fileID: 590786746}
|
||||
- component: {fileID: 590786745}
|
||||
- component: {fileID: 590786749}
|
||||
m_Layer: 0
|
||||
m_Name: CollisionDetector
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &590786744
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 590786743}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -0, y: -0.0046, z: 0.003774}
|
||||
m_LocalScale: {x: 0.038507, y: 0.086992, z: 0.019573309}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 504407171}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!54 &590786745
|
||||
Rigidbody:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 590786743}
|
||||
serializedVersion: 4
|
||||
m_Mass: 1
|
||||
m_Drag: 0
|
||||
m_AngularDrag: 0.05
|
||||
m_CenterOfMass: {x: 0, y: 0, z: 0}
|
||||
m_InertiaTensor: {x: 1, y: 1, z: 1}
|
||||
m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ImplicitCom: 1
|
||||
m_ImplicitTensor: 1
|
||||
m_UseGravity: 1
|
||||
m_IsKinematic: 1
|
||||
m_Interpolate: 0
|
||||
m_Constraints: 0
|
||||
m_CollisionDetection: 0
|
||||
--- !u!65 &590786746
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 590786743}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 1
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Size: {x: 1, y: 1, z: 1}
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!23 &590786747
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 590786743}
|
||||
m_Enabled: 0
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
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: 31321ba15b8f8eb4c954353edc038b1d, 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!33 &590786748
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 590786743}
|
||||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!114 &590786749
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 590786743}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: c483aaa5a3e9e2237ab441fef7d1de0e, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
tagsToDetect: []
|
||||
--- !u!1 &661231382
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -1107,6 +1269,7 @@ GameObject:
|
|||
m_Component:
|
||||
- component: {fileID: 661231383}
|
||||
- component: {fileID: 661231384}
|
||||
- component: {fileID: 661231385}
|
||||
m_Layer: 0
|
||||
m_Name: vcam
|
||||
m_TagString: Untagged
|
||||
|
|
@ -1169,6 +1332,29 @@ MonoBehaviour:
|
|||
m_Calls: []
|
||||
m_LegacyBlendHint: 0
|
||||
m_ComponentOwner: {fileID: 435747088}
|
||||
--- !u!114 &661231385
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 661231382}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 00b2d199b96b516448144ab30fb26aed, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_ApplyAfter: 2
|
||||
m_ChannelMask: 1
|
||||
m_Gain: 1
|
||||
m_Use2DDistance: 0
|
||||
m_UseCameraSpace: 1
|
||||
m_ReactionSettings:
|
||||
m_SecondaryNoise: {fileID: 11400000, guid: 69ce8388f6785dd4c8c39915efece2f4, type: 2}
|
||||
m_AmplitudeGain: 1
|
||||
m_FrequencyGain: 1
|
||||
m_Duration: 1
|
||||
m_NoiseOffsets: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &723299404
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -6723,6 +6909,7 @@ GameObject:
|
|||
m_Component:
|
||||
- component: {fileID: 1498859630}
|
||||
- component: {fileID: 1498859629}
|
||||
- component: {fileID: 1498859631}
|
||||
m_Layer: 0
|
||||
m_Name: GameManager
|
||||
m_TagString: Untagged
|
||||
|
|
@ -6762,6 +6949,14 @@ MonoBehaviour:
|
|||
- 3.751
|
||||
- 7.34
|
||||
car: {fileID: 504407171}
|
||||
collisionDetector: {fileID: 590786749}
|
||||
impulseSource: {fileID: 1498859631}
|
||||
trafficVehiclePrefab: {fileID: 1278714955272072240, guid: 2cd19f7ca8acca0588c2ffcfee899097,
|
||||
type: 3}
|
||||
trafficVehicles: []
|
||||
maxTrafficVehicles: 10
|
||||
trafficVehicleSpawnInterval: 5
|
||||
lives: 3
|
||||
--- !u!4 &1498859630
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -6777,6 +6972,59 @@ Transform:
|
|||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1498859631
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1498859628}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 180ecf9b41d478f468eb3e9083753217, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_ImpulseDefinition:
|
||||
m_ImpulseChannel: 1
|
||||
m_ImpulseShape: 3
|
||||
m_CustomImpulseShape:
|
||||
serializedVersion: 2
|
||||
m_Curve: []
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
m_ImpulseDuration: 0.2
|
||||
m_ImpulseType: 0
|
||||
m_DissipationRate: 0.25
|
||||
m_RawSignal: {fileID: 0}
|
||||
m_AmplitudeGain: 1
|
||||
m_FrequencyGain: 1
|
||||
m_RepeatMode: 0
|
||||
m_Randomize: 1
|
||||
m_TimeEnvelope:
|
||||
m_AttackShape:
|
||||
serializedVersion: 2
|
||||
m_Curve: []
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
m_DecayShape:
|
||||
serializedVersion: 2
|
||||
m_Curve: []
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
m_AttackTime: 0
|
||||
m_SustainTime: 0.2
|
||||
m_DecayTime: 0.7
|
||||
m_ScaleWithImpact: 1
|
||||
m_HoldForever: 0
|
||||
m_ImpactRadius: 100
|
||||
m_DirectionMode: 0
|
||||
m_DissipationMode: 2
|
||||
m_DissipationDistance: 100
|
||||
m_PropagationSpeed: 343
|
||||
m_DefaultVelocity: {x: 0, y: -1, z: 0}
|
||||
--- !u!1 &1509633896
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -8225,6 +8473,11 @@ PrefabInstance:
|
|||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8284183663387107483, guid: 2ec69c05c0913d1b19d2df80ea44d31c,
|
||||
type: 3}
|
||||
propertyPath: m_Enabled
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
|
|
|
|||
29
Assets/Scripts/CollisionDetector.cs
Normal file
29
Assets/Scripts/CollisionDetector.cs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
|
||||
public class CollisionDetector : MonoBehaviour
|
||||
{
|
||||
public List<string> tagsToDetect;
|
||||
|
||||
public Action<Collider> OnEnter;
|
||||
public Action<Collider> OnExit;
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if(tagsToDetect.Contains(other.tag) || tagsToDetect.Count == 0)
|
||||
{
|
||||
OnEnter?.Invoke(other);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerExit(Collider other)
|
||||
{
|
||||
if(tagsToDetect.Contains(other.tag) || tagsToDetect.Count == 0)
|
||||
{
|
||||
OnExit?.Invoke(other);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/Scripts/CollisionDetector.cs.meta
Normal file
11
Assets/Scripts/CollisionDetector.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c483aaa5a3e9e2237ab441fef7d1de0e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -7,6 +7,10 @@ using static UnityEngine.ParticleSystem;
|
|||
|
||||
public class GameManager : MonoBehaviour
|
||||
{
|
||||
public static GameManager instance;
|
||||
public void Awake(){
|
||||
instance = this;
|
||||
}
|
||||
public static float movespeed = 0f;
|
||||
public float acceleration = 5;
|
||||
|
||||
|
|
@ -30,14 +34,22 @@ public class GameManager : MonoBehaviour
|
|||
public float laneSwitchRotationMultiplier = 0.2f;
|
||||
public float[] laneXs = {-1.5f, 0f, 1.5f};
|
||||
public Transform car;
|
||||
public CollisionDetector collisionDetector;
|
||||
|
||||
EmissionModule speedLinesEmission;
|
||||
public CinemachineImpulseSource impulseSource;
|
||||
public GameObject trafficVehiclePrefab;
|
||||
public List<GameObject> trafficVehicles = new List<GameObject>();
|
||||
public int maxTrafficVehicles = 10;
|
||||
public float trafficVehicleSpawnInterval = 5f;
|
||||
float trafficVehicleSpawnTimer =0f;
|
||||
|
||||
float startRotationY;
|
||||
void Start()
|
||||
{
|
||||
speedLinesEmission = speedLinesEffect.emission;
|
||||
startRotationY = car.eulerAngles.y;
|
||||
collisionDetector.OnEnter += OnTriggerEnter;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
|
|
@ -48,6 +60,24 @@ public class GameManager : MonoBehaviour
|
|||
|
||||
void Update(){
|
||||
SwitchLanes();
|
||||
TrafficVehicleSpawn();
|
||||
}
|
||||
|
||||
void TrafficVehicleSpawn(){
|
||||
trafficVehicleSpawnTimer += Time.deltaTime * movespeed / maxspeed;
|
||||
if(trafficVehicleSpawnTimer >= trafficVehicleSpawnInterval){
|
||||
trafficVehicleSpawnTimer = 0;
|
||||
SpawnNextTrafficVehicle();
|
||||
}
|
||||
}
|
||||
|
||||
void SpawnNextTrafficVehicle(){
|
||||
trafficVehicles.RemoveAll(item => item == null);
|
||||
|
||||
if(trafficVehicles.Count < maxTrafficVehicles){
|
||||
GameObject trafficVehicle = Instantiate(trafficVehiclePrefab, new Vector3(laneXs[currentLaneId], 0, -500), Quaternion.Euler(0,-90,0));
|
||||
trafficVehicles.Add(trafficVehicle);
|
||||
}
|
||||
}
|
||||
|
||||
float laneSwitchTime =0;
|
||||
|
|
@ -105,4 +135,31 @@ float displaySpeed = 0;
|
|||
speedLinesEmission.rateOverTime = displaySpeed > 100 ? displaySpeed : 0;
|
||||
}
|
||||
|
||||
public int lives = 3;
|
||||
|
||||
void OnTriggerEnter(Collider other)
|
||||
{
|
||||
Debug.Log("OnTriggerEnter: " + other.gameObject.name + " : " + other.gameObject.tag);
|
||||
string objectNameLowered = other.gameObject.name.ToLower();
|
||||
if(objectNameLowered.Contains("section")){
|
||||
return;
|
||||
}
|
||||
|
||||
if(objectNameLowered.Contains("player")){
|
||||
return;
|
||||
}
|
||||
|
||||
movespeed = maxspeed / 10f;
|
||||
lives--;
|
||||
LivesVisualizer.instance.SetLives(lives);
|
||||
impulseSource.GenerateImpulse();
|
||||
|
||||
//Snap to lane
|
||||
car.position = new Vector3(laneXs[currentLaneId], car.position.y, car.position.z);
|
||||
|
||||
if(other.GetComponent<TrafficVehicle>()!=null){
|
||||
Destroy(other.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,10 +5,33 @@ using UnityEngine;
|
|||
public class LivesVisualizer : MonoBehaviour
|
||||
{
|
||||
public Transform livesParent;
|
||||
public static LivesVisualizer instance;
|
||||
|
||||
public void Awake(){
|
||||
instance = this;
|
||||
SetLives(3);
|
||||
}
|
||||
|
||||
|
||||
public void SetLives(int lives){
|
||||
for(int i = 0; i < livesParent.childCount; i++){
|
||||
livesParent.GetChild(i).gameObject.SetActive(i < lives);
|
||||
bool prevState = livesParent.GetChild(i).gameObject.activeSelf;
|
||||
bool newState = i < lives;
|
||||
if(prevState != newState){
|
||||
StartCoroutine(FlashLife(livesParent.GetChild(i).gameObject,newState));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float flashDuration = 0.3f;
|
||||
IEnumerator FlashLife(GameObject life, bool state){
|
||||
life.SetActive(state);
|
||||
for(int i=0; i < 4; i++){
|
||||
life.SetActive(!state);
|
||||
yield return new WaitForSeconds(0.1f);
|
||||
life.SetActive(state);
|
||||
yield return new WaitForSeconds(0.1f);
|
||||
}
|
||||
life.SetActive(state);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
20
Assets/Scripts/TrafficVehicle.cs
Normal file
20
Assets/Scripts/TrafficVehicle.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class TrafficVehicle : MonoBehaviour
|
||||
{
|
||||
public float speed = 10f;
|
||||
void FixedUpdate()
|
||||
{
|
||||
transform.position += new Vector3(0, 0, speed + GameManager.movespeed) * Time.deltaTime;
|
||||
}
|
||||
|
||||
void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if(other.tag.ToLower().Contains("destroy")){
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
11
Assets/Scripts/TrafficVehicle.cs.meta
Normal file
11
Assets/Scripts/TrafficVehicle.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 843f3385775543448a5ac7f3f452567d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"com.boxqkrtm.ide.cursor": "https://github.com/boxqkrtm/com.unity.ide.cursor.git",
|
||||
"com.unity.cinemachine": "2.9.7",
|
||||
"com.unity.collab-proxy": "2.9.3",
|
||||
"com.unity.ide.rider": "3.0.37",
|
||||
|
|
|
|||
|
|
@ -1,14 +1,5 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"com.boxqkrtm.ide.cursor": {
|
||||
"version": "https://github.com/boxqkrtm/com.unity.ide.cursor.git",
|
||||
"depth": 0,
|
||||
"source": "git",
|
||||
"dependencies": {
|
||||
"com.unity.test-framework": "1.1.9"
|
||||
},
|
||||
"hash": "38fecf55e4fd94ccfe58a92ed8ad1a529ba1694e"
|
||||
},
|
||||
"com.unity.burst": {
|
||||
"version": "1.8.8",
|
||||
"depth": 1,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user