From fdb5793d077f7df0398f80581ba539859a7724ee Mon Sep 17 00:00:00 2001 From: Jordan Orelli Date: Sat, 13 Jun 2020 13:44:03 -0500 Subject: [PATCH] seekers no longer go over edge --- Assets/Prefabs/Player.prefab | 2 +- Assets/Prefabs/Seeker.prefab | 17 +- Assets/Prefabs/TouchHazard.prefab | 2 +- Assets/Scenes/Level One.unity | 853 +++++++++++++++++++++++++++++- Assets/Scripts/Seeker.cs | 37 +- 5 files changed, 895 insertions(+), 16 deletions(-) diff --git a/Assets/Prefabs/Player.prefab b/Assets/Prefabs/Player.prefab index 5989767..f86deab 100644 --- a/Assets/Prefabs/Player.prefab +++ b/Assets/Prefabs/Player.prefab @@ -181,7 +181,7 @@ MonoBehaviour: verticalRayCount: 4 collisionMask: serializedVersion: 2 - m_Bits: 1024 + m_Bits: 5120 --- !u!33 &4623847142764859895 MeshFilter: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/Seeker.prefab b/Assets/Prefabs/Seeker.prefab index 8de2ec3..86c7f9e 100644 --- a/Assets/Prefabs/Seeker.prefab +++ b/Assets/Prefabs/Seeker.prefab @@ -11,7 +11,7 @@ GameObject: - component: {fileID: 7060401994191104731} - component: {fileID: 5573151690328125724} - component: {fileID: 6556052836947673} - m_Layer: 10 + m_Layer: 12 m_Name: Quad (2) m_TagString: Enemy m_Icon: {fileID: 0} @@ -90,7 +90,7 @@ GameObject: - component: {fileID: 5364803949657740408} - component: {fileID: 2861228925036942120} - component: {fileID: 1667865045350920548} - m_Layer: 10 + m_Layer: 12 m_Name: Quad m_TagString: Enemy m_Icon: {fileID: 0} @@ -169,7 +169,7 @@ GameObject: - component: {fileID: 5582799155841231266} - component: {fileID: 107700806923936450} - component: {fileID: 3417311567515930613} - m_Layer: 10 + m_Layer: 12 m_Name: Quad (1) m_TagString: Enemy m_Icon: {fileID: 0} @@ -248,7 +248,7 @@ GameObject: - component: {fileID: 7256333555795088408} - component: {fileID: 6384690151527866867} - component: {fileID: 8930050421128870906} - m_Layer: 10 + m_Layer: 12 m_Name: Quad m_TagString: Enemy m_Icon: {fileID: 0} @@ -327,7 +327,7 @@ GameObject: - component: {fileID: 6256090559880854698} - component: {fileID: 2844899039713441137} - component: {fileID: 4433057717770240425} - m_Layer: 10 + m_Layer: 12 m_Name: Seeker m_TagString: Enemy m_Icon: {fileID: 0} @@ -366,10 +366,15 @@ MonoBehaviour: collisionMask: serializedVersion: 2 m_Bits: 3328 + groundingMask: + serializedVersion: 2 + m_Bits: 3072 range: 12.5 maxSpeed: 30 acceleration: 60 drag: 1 + bottomLeft: {x: -0.5, y: -0.5, z: 0} + bottomRight: {x: 0.5, y: -0.5, z: 0} --- !u!60 &4433057717770240425 PolygonCollider2D: m_ObjectHideFlags: 0 @@ -413,7 +418,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 6222642643292148606} - m_Layer: 10 + m_Layer: 12 m_Name: GameObject m_TagString: Enemy m_Icon: {fileID: 0} diff --git a/Assets/Prefabs/TouchHazard.prefab b/Assets/Prefabs/TouchHazard.prefab index c682fe5..9b6db26 100644 --- a/Assets/Prefabs/TouchHazard.prefab +++ b/Assets/Prefabs/TouchHazard.prefab @@ -13,7 +13,7 @@ GameObject: - component: {fileID: 3308651302778791220} - component: {fileID: 2621347461924576989} - component: {fileID: 8618276481035816493} - m_Layer: 10 + m_Layer: 12 m_Name: TouchHazard m_TagString: Untagged m_Icon: {fileID: 0} diff --git a/Assets/Scenes/Level One.unity b/Assets/Scenes/Level One.unity index 73b38fc..23859ba 100644 --- a/Assets/Scenes/Level One.unity +++ b/Assets/Scenes/Level One.unity @@ -121,6 +121,75 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} +--- !u!1001 &74671321 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalPosition.x + value: 171.5 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalPosition.y + value: 15.5 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_RootOrder + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6587377380775331478, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_Name + value: Seeker (3) + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: e7828cb028738b644aecc663b1440577, type: 3} --- !u!1001 &163720077 PrefabInstance: m_ObjectHideFlags: 0 @@ -195,6 +264,12 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 65e5186cd12857e4cb379b3145d0a2e3, type: 3} +--- !u!4 &166418735 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + m_PrefabInstance: {fileID: 1868924270} + m_PrefabAsset: {fileID: 0} --- !u!1 &175472252 GameObject: m_ObjectHideFlags: 0 @@ -229,6 +304,75 @@ Transform: m_Father: {fileID: 566845947} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &216101199 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalPosition.x + value: 145.5 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalPosition.y + value: 17.5 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_RootOrder + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6587377380775331478, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_Name + value: Seeker (1) + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: e7828cb028738b644aecc663b1440577, type: 3} --- !u!4 &264502529 stripped Transform: m_CorrespondingSourceObject: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, @@ -280,7 +424,7 @@ PrefabInstance: - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, type: 3} propertyPath: m_RootOrder - value: 5 + value: 7 objectReference: {fileID: 0} - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, type: 3} @@ -316,6 +460,91 @@ Transform: type: 3} m_PrefabInstance: {fileID: 703476314} m_PrefabAsset: {fileID: 0} +--- !u!1001 &367796382 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 566845947} + m_Modifications: + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalPosition.x + value: 171.5 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalPosition.y + value: -5 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_RootOrder + value: 17 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalScale.x + value: 13 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalScale.y + value: 40 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901745, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_Name + value: Box (14) + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 65e5186cd12857e4cb379b3145d0a2e3, type: 3} +--- !u!4 &424784224 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + m_PrefabInstance: {fileID: 665254324} + m_PrefabAsset: {fileID: 0} --- !u!1 &566845946 GameObject: m_ObjectHideFlags: 0 @@ -356,9 +585,85 @@ Transform: - {fileID: 1332249767} - {fileID: 874428536} - {fileID: 326790833} + - {fileID: 1236037075} + - {fileID: 1759067892} + - {fileID: 166418735} + - {fileID: 424784224} + - {fileID: 935173938} + - {fileID: 1439916810} + - {fileID: 2056522380} m_Father: {fileID: 0} - m_RootOrder: 4 + m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &572048429 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalPosition.x + value: 158.5 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalPosition.y + value: 13.5 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_RootOrder + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6587377380775331478, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_Name + value: Seeker (2) + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: e7828cb028738b644aecc663b1440577, type: 3} --- !u!1001 &603318796 PrefabInstance: m_ObjectHideFlags: 0 @@ -478,7 +783,7 @@ PrefabInstance: - target: {fileID: 4623847142764859880, guid: b29a944aaba25f643afdc6b049845662, type: 3} propertyPath: m_RootOrder - value: 3 + value: 5 objectReference: {fileID: 0} - target: {fileID: 4623847142764859880, guid: b29a944aaba25f643afdc6b049845662, type: 3} @@ -538,8 +843,87 @@ Transform: - {fileID: 1683118920} - {fileID: 1589460801} m_Father: {fileID: 0} - m_RootOrder: 6 + m_RootOrder: 8 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &665254324 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 566845947} + m_Modifications: + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalPosition.x + value: 158.5 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalPosition.y + value: -6 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_RootOrder + value: 16 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalScale.x + value: 13 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalScale.y + value: 38 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901745, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_Name + value: Box (13) + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 65e5186cd12857e4cb379b3145d0a2e3, type: 3} --- !u!1001 &667398603 PrefabInstance: m_ObjectHideFlags: 0 @@ -689,7 +1073,7 @@ PrefabInstance: - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, type: 3} propertyPath: m_LocalScale.y - value: 34.998997 + value: 35 objectReference: {fileID: 0} - target: {fileID: 9158705512601901745, guid: 65e5186cd12857e4cb379b3145d0a2e3, type: 3} @@ -953,6 +1337,12 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 65e5186cd12857e4cb379b3145d0a2e3, type: 3} +--- !u!4 &935173938 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + m_PrefabInstance: {fileID: 367796382} + m_PrefabAsset: {fileID: 0} --- !u!1001 &948105342 PrefabInstance: m_ObjectHideFlags: 0 @@ -1156,7 +1546,7 @@ PrefabInstance: - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, type: 3} propertyPath: m_RootOrder - value: 1 + value: 3 objectReference: {fileID: 0} - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, type: 3} @@ -1254,6 +1644,91 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 65e5186cd12857e4cb379b3145d0a2e3, type: 3} +--- !u!1001 &1157931065 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 566845947} + m_Modifications: + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalPosition.x + value: 135 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalPosition.y + value: -4.5 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_RootOrder + value: 13 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalScale.x + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalScale.y + value: 41 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901745, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_Name + value: Box (10) + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 65e5186cd12857e4cb379b3145d0a2e3, type: 3} +--- !u!4 &1236037075 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + m_PrefabInstance: {fileID: 1157931065} + m_PrefabAsset: {fileID: 0} --- !u!1001 &1244423993 PrefabInstance: m_ObjectHideFlags: 0 @@ -1334,6 +1809,85 @@ Transform: type: 3} m_PrefabInstance: {fileID: 1568176050} m_PrefabAsset: {fileID: 0} +--- !u!1001 &1356090592 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 566845947} + m_Modifications: + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalPosition.x + value: 137.5 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalPosition.y + value: -3 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_RootOrder + value: 14 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalScale.x + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalScale.y + value: 44 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901745, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_Name + value: Box (11) + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 65e5186cd12857e4cb379b3145d0a2e3, type: 3} --- !u!1001 &1404461471 PrefabInstance: m_ObjectHideFlags: 0 @@ -1414,6 +1968,12 @@ Transform: type: 3} m_PrefabInstance: {fileID: 837919785} m_PrefabAsset: {fileID: 0} +--- !u!4 &1439916810 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + m_PrefabInstance: {fileID: 1939239219} + m_PrefabAsset: {fileID: 0} --- !u!4 &1462220314 stripped Transform: m_CorrespondingSourceObject: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, @@ -1638,7 +2198,7 @@ PrefabInstance: - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, type: 3} propertyPath: m_RootOrder - value: 2 + value: 4 objectReference: {fileID: 0} - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, type: 3} @@ -1742,6 +2302,85 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 65e5186cd12857e4cb379b3145d0a2e3, type: 3} +--- !u!1001 &1675336887 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 566845947} + m_Modifications: + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalPosition.x + value: 209.925 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalPosition.y + value: -3 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_RootOrder + value: 19 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalScale.x + value: 20 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalScale.y + value: 44 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901745, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_Name + value: Box (16) + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 65e5186cd12857e4cb379b3145d0a2e3, type: 3} --- !u!1 &1683118919 GameObject: m_ObjectHideFlags: 0 @@ -1842,6 +2481,12 @@ Transform: type: 3} m_PrefabInstance: {fileID: 1010107064} m_PrefabAsset: {fileID: 0} +--- !u!4 &1759067892 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + m_PrefabInstance: {fileID: 1356090592} + m_PrefabAsset: {fileID: 0} --- !u!1001 &1826716311 PrefabInstance: m_ObjectHideFlags: 0 @@ -1921,6 +2566,85 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 65e5186cd12857e4cb379b3145d0a2e3, type: 3} +--- !u!1001 &1868924270 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 566845947} + m_Modifications: + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalPosition.x + value: 145.5 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalPosition.y + value: -4 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_RootOrder + value: 15 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalScale.x + value: 13 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalScale.y + value: 42 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901745, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_Name + value: Box (12) + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 65e5186cd12857e4cb379b3145d0a2e3, type: 3} --- !u!4 &1870975586 stripped Transform: m_CorrespondingSourceObject: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, @@ -1933,12 +2657,97 @@ Transform: type: 3} m_PrefabInstance: {fileID: 948105342} m_PrefabAsset: {fileID: 0} +--- !u!1001 &1939239219 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 566845947} + m_Modifications: + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalPosition.x + value: 189 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalPosition.y + value: -4 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_RootOrder + value: 18 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalScale.x + value: 22 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_LocalScale.y + value: 42 + objectReference: {fileID: 0} + - target: {fileID: 9158705512601901745, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + propertyPath: m_Name + value: Box (15) + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 65e5186cd12857e4cb379b3145d0a2e3, type: 3} --- !u!4 &2024523014 stripped Transform: m_CorrespondingSourceObject: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, type: 3} m_PrefabInstance: {fileID: 1244423993} m_PrefabAsset: {fileID: 0} +--- !u!4 &2056522380 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, + type: 3} + m_PrefabInstance: {fileID: 1675336887} + m_PrefabAsset: {fileID: 0} --- !u!4 &2122808828 stripped Transform: m_CorrespondingSourceObject: {fileID: 9158705512601901646, guid: 65e5186cd12857e4cb379b3145d0a2e3, @@ -1957,6 +2766,26 @@ PrefabInstance: propertyPath: m_Shadows.m_Type value: 1 objectReference: {fileID: 0} + - target: {fileID: 285906647213518343, guid: 010f3b22dd44d7243b99c251d7191762, + type: 3} + propertyPath: m_Intensity + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 285906647213518343, guid: 010f3b22dd44d7243b99c251d7191762, + type: 3} + propertyPath: m_SpotAngle + value: 50 + objectReference: {fileID: 0} + - target: {fileID: 285906647213518343, guid: 010f3b22dd44d7243b99c251d7191762, + type: 3} + propertyPath: m_Type + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 285906647213518343, guid: 010f3b22dd44d7243b99c251d7191762, + type: 3} + propertyPath: m_Color.a + value: 1 + objectReference: {fileID: 0} - target: {fileID: 898215030330395392, guid: 010f3b22dd44d7243b99c251d7191762, type: 3} propertyPath: m_Name @@ -1967,6 +2796,11 @@ PrefabInstance: propertyPath: player value: objectReference: {fileID: 645846018} + - target: {fileID: 898215030330395395, guid: 010f3b22dd44d7243b99c251d7191762, + type: 3} + propertyPath: orthographic + value: 1 + objectReference: {fileID: 0} - target: {fileID: 898215030330395644, guid: 010f3b22dd44d7243b99c251d7191762, type: 3} propertyPath: m_LocalPosition.x @@ -2022,6 +2856,11 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 1933385804358403792, guid: 010f3b22dd44d7243b99c251d7191762, + type: 3} + propertyPath: m_LocalPosition.z + value: 0.5 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 010f3b22dd44d7243b99c251d7191762, type: 3} --- !u!4 &2385351259190542868 stripped diff --git a/Assets/Scripts/Seeker.cs b/Assets/Scripts/Seeker.cs index 0bf105b..ef0d28d 100644 --- a/Assets/Scripts/Seeker.cs +++ b/Assets/Scripts/Seeker.cs @@ -4,10 +4,14 @@ using UnityEngine; public class Seeker : MonoBehaviour { public LayerMask collisionMask; + public LayerMask groundingMask; public float range = 3.0f; public float maxSpeed = 3.0f; // units per second public float acceleration = 3.0f; // increase in velocity per second public float drag = 1.0f; + public Vector3 bottomLeft; + public Vector3 bottomRight; + private float skinDepth = 0.01f; private Vector3 pivot; private Vector3 leftMax; @@ -29,7 +33,38 @@ public class Seeker : MonoBehaviour { void Update() { detectPlayer(); velocity.x = Mathf.Clamp(velocity.x, -maxSpeed, maxSpeed); - transform.position = transform.position + velocity * Time.deltaTime; + Vector3 next = transform.position + velocity * Time.deltaTime; + Debug.LogFormat("{0} x velocity: {1}", gameObject.name, velocity.x); + + if (velocity.x >= 0) { + // if we're moving right, cast a ray from the bottom right corner to make sure we don't go over the ledge + RaycastHit2D hitRight = Physics2D.Raycast(transform.position + bottomRight + skinDepth * Vector3.up, Vector2.down, Mathf.Infinity, groundingMask); + RaycastHit2D nextHitRight = Physics2D.Raycast(next + bottomRight + skinDepth * Vector3.up, Vector2.down, Mathf.Infinity, groundingMask); + hitRight.distance -= skinDepth; + nextHitRight.distance -= skinDepth; + Debug.LogFormat("Hit Right: {0} Dist: {1} Next Hit Right: {2} Dist: {3}", hitRight, hitRight.distance, nextHitRight, nextHitRight.distance); + // this is gross but because we're only placing blocks in unit + // increments we can avoid rounding comparison errors by just + // checking if the difference between this height and the next + // height is less than half our minimum delta that we use in the + // levels. This is faster than figuring out a real solution. + if (Mathf.Abs(nextHitRight.distance - hitRight.distance) < 0.5f) { + transform.position = next; + } else { + velocity.x = 0; + } + } else { + // if we're moving left, cast a ray from the bottom left corner to make sure we don't go over the ledge + RaycastHit2D hitLeft = Physics2D.Raycast(transform.position + bottomLeft + skinDepth * Vector3.up, Vector2.down, Mathf.Infinity, groundingMask); + RaycastHit2D nextHitLeft = Physics2D.Raycast(next + bottomLeft + skinDepth * Vector3.up, Vector2.down, Mathf.Infinity, groundingMask); + hitLeft.distance -= skinDepth; + nextHitLeft.distance -= skinDepth; + if (Mathf.Abs(hitLeft.distance - nextHitLeft.distance) < 0.5f) { + transform.position = next; + } else { + velocity.x = 0; + } + } } private void detectPlayer() {