Pretty ok transition in out of safe zone
This commit is contained in:
parent
10f36045f8
commit
35b28e65b4
1741
Assets/Prefabs/Arena.prefab
Normal file
1741
Assets/Prefabs/Arena.prefab
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Prefabs/Arena.prefab.meta
Normal file
7
Assets/Prefabs/Arena.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 581322f036f3ff1448d4d2ec70f295a4
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -123,137 +123,6 @@ NavMeshSettings:
|
|||||||
debug:
|
debug:
|
||||||
m_Flags: 0
|
m_Flags: 0
|
||||||
m_NavMeshData: {fileID: 0}
|
m_NavMeshData: {fileID: 0}
|
||||||
--- !u!1 &172269149
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 172269152}
|
|
||||||
- component: {fileID: 172269151}
|
|
||||||
- component: {fileID: 172269150}
|
|
||||||
- component: {fileID: 172269153}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: Square (1)
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!61 &172269150
|
|
||||||
BoxCollider2D:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 172269149}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_Density: 1
|
|
||||||
m_Material: {fileID: 0}
|
|
||||||
m_IsTrigger: 0
|
|
||||||
m_UsedByEffector: 0
|
|
||||||
m_UsedByComposite: 0
|
|
||||||
m_Offset: {x: 0, y: 0}
|
|
||||||
m_SpriteTilingProperty:
|
|
||||||
border: {x: 0, y: 0, z: 0, w: 0}
|
|
||||||
pivot: {x: 0.5, y: 0.5}
|
|
||||||
oldSize: {x: 1, y: 1}
|
|
||||||
newSize: {x: 1, y: 1}
|
|
||||||
adaptiveTilingThreshold: 0.5
|
|
||||||
drawMode: 0
|
|
||||||
adaptiveTiling: 0
|
|
||||||
m_AutoTiling: 0
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Size: {x: 1, y: 1}
|
|
||||||
m_EdgeRadius: 0
|
|
||||||
--- !u!212 &172269151
|
|
||||||
SpriteRenderer:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 172269149}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_CastShadows: 0
|
|
||||||
m_ReceiveShadows: 0
|
|
||||||
m_DynamicOccludee: 1
|
|
||||||
m_MotionVectors: 1
|
|
||||||
m_LightProbeUsage: 1
|
|
||||||
m_ReflectionProbeUsage: 1
|
|
||||||
m_RayTracingMode: 0
|
|
||||||
m_RayTraceProcedural: 0
|
|
||||||
m_RenderingLayerMask: 1
|
|
||||||
m_RendererPriority: 0
|
|
||||||
m_Materials:
|
|
||||||
- {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, 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: 0
|
|
||||||
m_MinimumChartSize: 4
|
|
||||||
m_AutoUVMaxDistance: 0.5
|
|
||||||
m_AutoUVMaxAngle: 89
|
|
||||||
m_LightmapParameters: {fileID: 0}
|
|
||||||
m_SortingLayerID: 0
|
|
||||||
m_SortingLayer: 0
|
|
||||||
m_SortingOrder: 0
|
|
||||||
m_Sprite: {fileID: 7482667652216324306, guid: 48e93eef0688c4a259cb0eddcd8661f7, type: 3}
|
|
||||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
|
||||||
m_FlipX: 0
|
|
||||||
m_FlipY: 0
|
|
||||||
m_DrawMode: 0
|
|
||||||
m_Size: {x: 1, y: 1}
|
|
||||||
m_AdaptiveModeThreshold: 0.5
|
|
||||||
m_SpriteTileMode: 0
|
|
||||||
m_WasSpriteAssigned: 1
|
|
||||||
m_MaskInteraction: 0
|
|
||||||
m_SpriteSortPoint: 0
|
|
||||||
--- !u!4 &172269152
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 172269149}
|
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
||||||
m_LocalPosition: {x: -0.51, y: 2.62, z: 0}
|
|
||||||
m_LocalScale: {x: 4.313, y: 1.977754, z: 1}
|
|
||||||
m_Children: []
|
|
||||||
m_Father: {fileID: 0}
|
|
||||||
m_RootOrder: 4
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
||||||
--- !u!50 &172269153
|
|
||||||
Rigidbody2D:
|
|
||||||
serializedVersion: 4
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 172269149}
|
|
||||||
m_BodyType: 2
|
|
||||||
m_Simulated: 1
|
|
||||||
m_UseFullKinematicContacts: 0
|
|
||||||
m_UseAutoMass: 0
|
|
||||||
m_Mass: 1
|
|
||||||
m_LinearDrag: 0
|
|
||||||
m_AngularDrag: 0.05
|
|
||||||
m_GravityScale: 1
|
|
||||||
m_Material: {fileID: 0}
|
|
||||||
m_Interpolate: 0
|
|
||||||
m_SleepingMode: 1
|
|
||||||
m_CollisionDetection: 0
|
|
||||||
m_Constraints: 0
|
|
||||||
--- !u!1 &412174278
|
--- !u!1 &412174278
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 3
|
m_ObjectHideFlags: 3
|
||||||
@ -406,139 +275,8 @@ Transform:
|
|||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 412174279}
|
- {fileID: 412174279}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 6
|
m_RootOrder: 3
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &877291413
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 877291416}
|
|
||||||
- component: {fileID: 877291415}
|
|
||||||
- component: {fileID: 877291414}
|
|
||||||
- component: {fileID: 877291417}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: Square (2)
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!61 &877291414
|
|
||||||
BoxCollider2D:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 877291413}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_Density: 1
|
|
||||||
m_Material: {fileID: 0}
|
|
||||||
m_IsTrigger: 0
|
|
||||||
m_UsedByEffector: 0
|
|
||||||
m_UsedByComposite: 0
|
|
||||||
m_Offset: {x: 0, y: 0}
|
|
||||||
m_SpriteTilingProperty:
|
|
||||||
border: {x: 0, y: 0, z: 0, w: 0}
|
|
||||||
pivot: {x: 0.5, y: 0.5}
|
|
||||||
oldSize: {x: 1, y: 1}
|
|
||||||
newSize: {x: 1, y: 1}
|
|
||||||
adaptiveTilingThreshold: 0.5
|
|
||||||
drawMode: 0
|
|
||||||
adaptiveTiling: 0
|
|
||||||
m_AutoTiling: 0
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Size: {x: 1, y: 1}
|
|
||||||
m_EdgeRadius: 0
|
|
||||||
--- !u!212 &877291415
|
|
||||||
SpriteRenderer:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 877291413}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_CastShadows: 0
|
|
||||||
m_ReceiveShadows: 0
|
|
||||||
m_DynamicOccludee: 1
|
|
||||||
m_MotionVectors: 1
|
|
||||||
m_LightProbeUsage: 1
|
|
||||||
m_ReflectionProbeUsage: 1
|
|
||||||
m_RayTracingMode: 0
|
|
||||||
m_RayTraceProcedural: 0
|
|
||||||
m_RenderingLayerMask: 1
|
|
||||||
m_RendererPriority: 0
|
|
||||||
m_Materials:
|
|
||||||
- {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, 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: 0
|
|
||||||
m_MinimumChartSize: 4
|
|
||||||
m_AutoUVMaxDistance: 0.5
|
|
||||||
m_AutoUVMaxAngle: 89
|
|
||||||
m_LightmapParameters: {fileID: 0}
|
|
||||||
m_SortingLayerID: 0
|
|
||||||
m_SortingLayer: 0
|
|
||||||
m_SortingOrder: 0
|
|
||||||
m_Sprite: {fileID: 7482667652216324306, guid: 48e93eef0688c4a259cb0eddcd8661f7, type: 3}
|
|
||||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
|
||||||
m_FlipX: 0
|
|
||||||
m_FlipY: 0
|
|
||||||
m_DrawMode: 0
|
|
||||||
m_Size: {x: 1, y: 1}
|
|
||||||
m_AdaptiveModeThreshold: 0.5
|
|
||||||
m_SpriteTileMode: 0
|
|
||||||
m_WasSpriteAssigned: 1
|
|
||||||
m_MaskInteraction: 0
|
|
||||||
m_SpriteSortPoint: 0
|
|
||||||
--- !u!4 &877291416
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 877291413}
|
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
||||||
m_LocalPosition: {x: -0.1786, y: -4.3891, z: 0}
|
|
||||||
m_LocalScale: {x: 5.3572, y: 0.34050018, z: 1}
|
|
||||||
m_Children: []
|
|
||||||
m_Father: {fileID: 0}
|
|
||||||
m_RootOrder: 5
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
||||||
--- !u!50 &877291417
|
|
||||||
Rigidbody2D:
|
|
||||||
serializedVersion: 4
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 877291413}
|
|
||||||
m_BodyType: 2
|
|
||||||
m_Simulated: 1
|
|
||||||
m_UseFullKinematicContacts: 0
|
|
||||||
m_UseAutoMass: 0
|
|
||||||
m_Mass: 1
|
|
||||||
m_LinearDrag: 0
|
|
||||||
m_AngularDrag: 0.05
|
|
||||||
m_GravityScale: 1
|
|
||||||
m_Material: {fileID: 0}
|
|
||||||
m_Interpolate: 0
|
|
||||||
m_SleepingMode: 1
|
|
||||||
m_CollisionDetection: 0
|
|
||||||
m_Constraints: 0
|
|
||||||
--- !u!4 &1483024674 stripped
|
--- !u!4 &1483024674 stripped
|
||||||
Transform:
|
Transform:
|
||||||
m_CorrespondingSourceObject: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3}
|
m_CorrespondingSourceObject: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3}
|
||||||
@ -679,7 +417,7 @@ MonoBehaviour:
|
|||||||
m_IgnoreTimeScale: 0
|
m_IgnoreTimeScale: 0
|
||||||
m_WorldUpOverride: {fileID: 0}
|
m_WorldUpOverride: {fileID: 0}
|
||||||
m_UpdateMethod: 2
|
m_UpdateMethod: 2
|
||||||
m_BlendUpdateMethod: 1
|
m_BlendUpdateMethod: 0
|
||||||
m_DefaultBlend:
|
m_DefaultBlend:
|
||||||
m_Style: 1
|
m_Style: 1
|
||||||
m_Time: 2
|
m_Time: 2
|
||||||
@ -696,137 +434,6 @@ MonoBehaviour:
|
|||||||
m_CameraActivatedEvent:
|
m_CameraActivatedEvent:
|
||||||
m_PersistentCalls:
|
m_PersistentCalls:
|
||||||
m_Calls: []
|
m_Calls: []
|
||||||
--- !u!1 &1886541322
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 1886541325}
|
|
||||||
- component: {fileID: 1886541324}
|
|
||||||
- component: {fileID: 1886541323}
|
|
||||||
- component: {fileID: 1886541326}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: Square
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!61 &1886541323
|
|
||||||
BoxCollider2D:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1886541322}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_Density: 1
|
|
||||||
m_Material: {fileID: 0}
|
|
||||||
m_IsTrigger: 0
|
|
||||||
m_UsedByEffector: 0
|
|
||||||
m_UsedByComposite: 0
|
|
||||||
m_Offset: {x: 0, y: 0}
|
|
||||||
m_SpriteTilingProperty:
|
|
||||||
border: {x: 0, y: 0, z: 0, w: 0}
|
|
||||||
pivot: {x: 0.5, y: 0.5}
|
|
||||||
oldSize: {x: 1, y: 1}
|
|
||||||
newSize: {x: 1, y: 1}
|
|
||||||
adaptiveTilingThreshold: 0.5
|
|
||||||
drawMode: 0
|
|
||||||
adaptiveTiling: 0
|
|
||||||
m_AutoTiling: 0
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Size: {x: 1, y: 1}
|
|
||||||
m_EdgeRadius: 0
|
|
||||||
--- !u!212 &1886541324
|
|
||||||
SpriteRenderer:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1886541322}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_CastShadows: 0
|
|
||||||
m_ReceiveShadows: 0
|
|
||||||
m_DynamicOccludee: 1
|
|
||||||
m_MotionVectors: 1
|
|
||||||
m_LightProbeUsage: 1
|
|
||||||
m_ReflectionProbeUsage: 1
|
|
||||||
m_RayTracingMode: 0
|
|
||||||
m_RayTraceProcedural: 0
|
|
||||||
m_RenderingLayerMask: 1
|
|
||||||
m_RendererPriority: 0
|
|
||||||
m_Materials:
|
|
||||||
- {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, 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: 0
|
|
||||||
m_MinimumChartSize: 4
|
|
||||||
m_AutoUVMaxDistance: 0.5
|
|
||||||
m_AutoUVMaxAngle: 89
|
|
||||||
m_LightmapParameters: {fileID: 0}
|
|
||||||
m_SortingLayerID: 0
|
|
||||||
m_SortingLayer: 0
|
|
||||||
m_SortingOrder: 0
|
|
||||||
m_Sprite: {fileID: 7482667652216324306, guid: 48e93eef0688c4a259cb0eddcd8661f7, type: 3}
|
|
||||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
|
||||||
m_FlipX: 0
|
|
||||||
m_FlipY: 0
|
|
||||||
m_DrawMode: 0
|
|
||||||
m_Size: {x: 1, y: 1}
|
|
||||||
m_AdaptiveModeThreshold: 0.5
|
|
||||||
m_SpriteTileMode: 0
|
|
||||||
m_WasSpriteAssigned: 1
|
|
||||||
m_MaskInteraction: 0
|
|
||||||
m_SpriteSortPoint: 0
|
|
||||||
--- !u!4 &1886541325
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1886541322}
|
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
||||||
m_LocalPosition: {x: 2.605, y: 0.769, z: 0}
|
|
||||||
m_LocalScale: {x: 1, y: 2.3386, z: 1}
|
|
||||||
m_Children: []
|
|
||||||
m_Father: {fileID: 0}
|
|
||||||
m_RootOrder: 3
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
||||||
--- !u!50 &1886541326
|
|
||||||
Rigidbody2D:
|
|
||||||
serializedVersion: 4
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1886541322}
|
|
||||||
m_BodyType: 2
|
|
||||||
m_Simulated: 1
|
|
||||||
m_UseFullKinematicContacts: 0
|
|
||||||
m_UseAutoMass: 0
|
|
||||||
m_Mass: 1
|
|
||||||
m_LinearDrag: 0
|
|
||||||
m_AngularDrag: 0.05
|
|
||||||
m_GravityScale: 1
|
|
||||||
m_Material: {fileID: 0}
|
|
||||||
m_Interpolate: 0
|
|
||||||
m_SleepingMode: 1
|
|
||||||
m_CollisionDetection: 0
|
|
||||||
m_Constraints: 0
|
|
||||||
--- !u!1 &2070667249
|
--- !u!1 &2070667249
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -956,3 +563,60 @@ PrefabInstance:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3}
|
||||||
|
--- !u!1001 &9196727425198912291
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
m_TransformParent: {fileID: 0}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 9196727425507610130, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3}
|
||||||
|
propertyPath: m_RootOrder
|
||||||
|
value: 4
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 9196727425507610130, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 9196727425507610130, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 9196727425507610130, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 9196727425507610130, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 9196727425507610130, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 9196727425507610130, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 9196727425507610130, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 9196727425507610130, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 9196727425507610130, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 9196727425507610130, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 9196727425507610131, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: Arena
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3}
|
||||||
|
|||||||
@ -14,3 +14,5 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
movementSpeed: 3
|
movementSpeed: 3
|
||||||
suckSpeed: 1
|
suckSpeed: 1
|
||||||
|
safeZoneJumpDuration: 1.2
|
||||||
|
safeZonePosition: {x: 0, y: 0, z: 0}
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using JetBrains.Annotations;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.InputSystem;
|
using UnityEngine.InputSystem;
|
||||||
|
|
||||||
@ -10,7 +9,10 @@ public class PlayerMovement : MonoBehaviour {
|
|||||||
|
|
||||||
PlayerInput playerInput;
|
PlayerInput playerInput;
|
||||||
Vector2 moveDirection;
|
Vector2 moveDirection;
|
||||||
BaseState currentState = new NormalMovementState();
|
BaseState currentState = new ImmobileMovementState();
|
||||||
|
SafeZone? safeZone;
|
||||||
|
|
||||||
|
bool lastJumpButton;
|
||||||
|
|
||||||
void Awake() {
|
void Awake() {
|
||||||
rb = GetComponent<Rigidbody2D>();
|
rb = GetComponent<Rigidbody2D>();
|
||||||
@ -22,6 +24,8 @@ public class PlayerMovement : MonoBehaviour {
|
|||||||
SwitchState(newState);
|
SwitchState(newState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnDrawGizmos() => currentState.OnDrawGizmos(this);
|
||||||
|
|
||||||
public void OnMove(InputAction.CallbackContext ctx) {
|
public void OnMove(InputAction.CallbackContext ctx) {
|
||||||
moveDirection = ctx.ReadValue<Vector2>();
|
moveDirection = ctx.ReadValue<Vector2>();
|
||||||
if (moveDirection.sqrMagnitude > 1.0f)
|
if (moveDirection.sqrMagnitude > 1.0f)
|
||||||
@ -29,10 +33,22 @@ public class PlayerMovement : MonoBehaviour {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void OnJump(InputAction.CallbackContext ctx) {
|
public void OnJump(InputAction.CallbackContext ctx) {
|
||||||
if (!ctx.ReadValueAsButton())
|
//feels pretty redundant ^^'
|
||||||
|
bool newValue = ctx.ReadValueAsButton();
|
||||||
|
bool wasJustPressed = !lastJumpButton && newValue;
|
||||||
|
lastJumpButton = newValue;
|
||||||
|
|
||||||
|
if (!wasJustPressed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SwitchState(new JumpingMovementState());
|
if (safeZone == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (safeZone.IsInSafeZone) {
|
||||||
|
if (moveDirection.magnitude >= safeZone.stats.minJumpJoystickValue)
|
||||||
|
SwitchState(new ExitSafeZoneMovementState(safeZone, moveDirection));
|
||||||
|
} else //TODO if (AngleBetween(moveDirection, toSafeZone) < 90)
|
||||||
|
SwitchState(new EnterSafeZoneMovementState(safeZone));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwitchState(BaseState newState) {
|
void SwitchState(BaseState newState) {
|
||||||
@ -40,22 +56,37 @@ public class PlayerMovement : MonoBehaviour {
|
|||||||
currentState = newState;
|
currentState = newState;
|
||||||
newState.EnterState(this);
|
newState.EnterState(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnTriggerEnter2D(Collider2D other) {
|
||||||
|
if (other.GetComponent<SafeZone>() is {} triggeredSafeZone)
|
||||||
|
safeZone = triggeredSafeZone;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Probably should remove, mostly for ImmobileState's draw gizmos
|
||||||
|
void OnTriggerStay2D(Collider2D other) {
|
||||||
|
if (other.GetComponent<SafeZone>() is {} triggeredSafeZone)
|
||||||
|
safeZone = triggeredSafeZone;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnTriggerExit2D(Collider2D other) {
|
||||||
|
if (other.GetComponent<SafeZone>() is {})
|
||||||
|
safeZone = null;
|
||||||
|
}
|
||||||
|
|
||||||
class BaseState {
|
class BaseState {
|
||||||
//TODO If we never do anything before enter, replace with constructor?
|
|
||||||
public virtual void EnterState(PlayerMovement playerMovement) {}
|
public virtual void EnterState(PlayerMovement playerMovement) {}
|
||||||
|
|
||||||
public virtual void LeaveState(PlayerMovement playerMovement) {}
|
public virtual void LeaveState(PlayerMovement playerMovement) {}
|
||||||
|
|
||||||
[CanBeNull]
|
public virtual BaseState? UpdateState(PlayerMovement playerMovement) => null;
|
||||||
public virtual BaseState UpdateState(PlayerMovement playerMovement) => null;
|
|
||||||
|
|
||||||
[CanBeNull]
|
public virtual BaseState? FixedUpdateState(PlayerMovement playerMovement) => null;
|
||||||
public virtual BaseState FixedUpdateState(PlayerMovement playerMovement) => null;
|
|
||||||
|
public virtual void OnDrawGizmos(PlayerMovement playerMovement) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
class NormalMovementState : BaseState {
|
class NormalMovementState : BaseState {
|
||||||
public override BaseState FixedUpdateState(PlayerMovement playerMovement) {
|
public override BaseState? FixedUpdateState(PlayerMovement playerMovement) {
|
||||||
playerMovement.rb.velocity = (Vector3)playerMovement.moveDirection * playerMovement.playerStats.movementSpeed;
|
playerMovement.rb.velocity = (Vector3)playerMovement.moveDirection * playerMovement.playerStats.movementSpeed;
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -63,26 +94,88 @@ public class PlayerMovement : MonoBehaviour {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class JumpingMovementState : BaseState {
|
class JumpingMovementState : BaseState {
|
||||||
|
readonly float duration;
|
||||||
|
readonly Vector3 target;
|
||||||
|
|
||||||
Vector3 startPosition;
|
Vector3 startPosition;
|
||||||
float startTime;
|
float startTime;
|
||||||
|
|
||||||
|
public JumpingMovementState(float duration, Vector3 target) {
|
||||||
|
this.duration = duration;
|
||||||
|
this.target = target;
|
||||||
|
}
|
||||||
|
|
||||||
public override void EnterState(PlayerMovement playerMovement) {
|
public override void EnterState(PlayerMovement playerMovement) {
|
||||||
startPosition = playerMovement.transform.position;
|
startPosition = playerMovement.transform.position;
|
||||||
startTime = Time.time;
|
startTime = Time.time;
|
||||||
|
|
||||||
|
playerMovement.rb.velocity = Vector2.zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override BaseState FixedUpdateState(PlayerMovement playerMovement) {
|
public override BaseState? FixedUpdateState(PlayerMovement playerMovement) {
|
||||||
float currentTime = Time.time - startTime;
|
float currentTime = Time.time - startTime;
|
||||||
if (currentTime >= playerMovement.playerStats.safeZoneJumpDuration)
|
if (currentTime >= duration)
|
||||||
return new NormalMovementState();
|
return Transition();
|
||||||
|
|
||||||
playerMovement.rb.MovePosition(Vector3.Lerp(
|
playerMovement.rb.MovePosition(Vector3.Lerp(
|
||||||
startPosition,
|
startPosition,
|
||||||
playerMovement.playerStats.safeZonePosition,
|
target,
|
||||||
currentTime / playerMovement.playerStats.safeZoneJumpDuration
|
CubicEaseOut(currentTime / duration)
|
||||||
));
|
));
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual BaseState Transition() => new NormalMovementState();
|
||||||
|
|
||||||
|
static float CubicEaseOut(float t) => 1 - Mathf.Pow(1 - t, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
class EnterSafeZoneMovementState : JumpingMovementState {
|
||||||
|
readonly SafeZone safeZone;
|
||||||
|
public EnterSafeZoneMovementState(SafeZone safeZone) : base(safeZone.stats.jumpDuration, safeZone.transform.position) {
|
||||||
|
this.safeZone = safeZone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void EnterState(PlayerMovement playerMovement) {
|
||||||
|
base.EnterState(playerMovement);
|
||||||
|
|
||||||
|
safeZone.EnterSafeZone();
|
||||||
|
playerMovement.rb.velocity = Vector2.zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override BaseState Transition() => new ImmobileMovementState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class ExitSafeZoneMovementState : JumpingMovementState {
|
||||||
|
readonly SafeZone safeZone;
|
||||||
|
public ExitSafeZoneMovementState(SafeZone safeZone, Vector2 direction) : base(safeZone.stats.jumpDuration, safeZone.GetOutsidePosition(direction)) {
|
||||||
|
this.safeZone = safeZone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void LeaveState(PlayerMovement playerMovement) {
|
||||||
|
base.EnterState(playerMovement);
|
||||||
|
|
||||||
|
safeZone.ExitSafeZone();
|
||||||
|
playerMovement.rb.velocity = Vector2.zero;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ImmobileMovementState : BaseState {
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
public override void OnDrawGizmos(PlayerMovement playerMovement) {
|
||||||
|
if (playerMovement.safeZone is null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Vector3 dropPosition = playerMovement.safeZone.GetOutsidePosition(playerMovement.moveDirection);
|
||||||
|
bool canJump = playerMovement.moveDirection.magnitude >= playerMovement.safeZone.stats.minJumpJoystickValue;
|
||||||
|
Gizmos.color = canJump ? Color.green : Color.red;
|
||||||
|
Gizmos.DrawLine(playerMovement.transform.position, dropPosition);
|
||||||
|
if (canJump)
|
||||||
|
Gizmos.DrawSphere(dropPosition, .5f);
|
||||||
|
else
|
||||||
|
Gizmos.DrawWireSphere(dropPosition, .5f);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4,8 +4,4 @@
|
|||||||
public class PlayerStats : ScriptableObject {
|
public class PlayerStats : ScriptableObject {
|
||||||
public float movementSpeed = 3f;
|
public float movementSpeed = 3f;
|
||||||
public float suckSpeed = 1f;
|
public float suckSpeed = 1f;
|
||||||
|
|
||||||
//TODO Move to SafeZone scriptable object or in Stage/ArenaComponent?
|
|
||||||
public float safeZoneJumpDuration = 1.5f;
|
|
||||||
public Vector3 safeZonePosition;
|
|
||||||
}
|
}
|
||||||
15
Assets/Scripts/Safe Zone Stats.asset
Normal file
15
Assets/Scripts/Safe Zone Stats.asset
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 7bb5b9d39d784569a22f3cf10d19c27b, type: 3}
|
||||||
|
m_Name: Safe Zone Stats
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
jumpDuration: 1.2
|
||||||
8
Assets/Scripts/Safe Zone Stats.asset.meta
Normal file
8
Assets/Scripts/Safe Zone Stats.asset.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 188711c0b201b1a45ad601ee20233b20
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
21
Assets/Scripts/SafeZone.cs
Normal file
21
Assets/Scripts/SafeZone.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class SafeZone : MonoBehaviour {
|
||||||
|
public SafeZoneStats stats;
|
||||||
|
[SerializeField] CircleCollider2D moatCollider;
|
||||||
|
public bool IsInSafeZone { get; private set; } = true;
|
||||||
|
|
||||||
|
public void EnterSafeZone() {
|
||||||
|
moatCollider.enabled = false;
|
||||||
|
IsInSafeZone = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ExitSafeZone() {
|
||||||
|
moatCollider.enabled = true;
|
||||||
|
IsInSafeZone = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector3 GetOutsidePosition(Vector2 direction) {
|
||||||
|
return transform.position + (moatCollider.radius + stats.jumpOffset) * (Vector3)direction;
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/SafeZone.cs.meta
Normal file
11
Assets/Scripts/SafeZone.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 63e66d66543b37e419694ac22a2941fd
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
11
Assets/Scripts/SafeZoneStats.cs
Normal file
11
Assets/Scripts/SafeZoneStats.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
[CreateAssetMenu]
|
||||||
|
public class SafeZoneStats : ScriptableObject {
|
||||||
|
[SerializeField] [Min(0f)]
|
||||||
|
public float jumpDuration = 1.2f;
|
||||||
|
[SerializeField] [Range(0f, 1f)]
|
||||||
|
public float minJumpJoystickValue = 0.5f;
|
||||||
|
[SerializeField] [Min(0f)]
|
||||||
|
public float jumpOffset = 1f;
|
||||||
|
}
|
||||||
3
Assets/Scripts/SafeZoneStats.cs.meta
Normal file
3
Assets/Scripts/SafeZoneStats.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7bb5b9d39d784569a22f3cf10d19c27b
|
||||||
|
timeCreated: 1648881833
|
||||||
Loading…
x
Reference in New Issue
Block a user