From 1cea56dbadeebb15b068ab33528c23b5aeb84efb Mon Sep 17 00:00:00 2001 From: Unknown Date: Fri, 25 Feb 2022 05:23:03 -0600 Subject: [PATCH] It works because hard corder very odd but yeah it works sorta yeah sorta. --- Assets/Scenes/Jacob's Scene.unity | 9 +++++--- Assets/UpdatedWallTrigger.cs | 35 +++++++++++++++++++------------ 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/Assets/Scenes/Jacob's Scene.unity b/Assets/Scenes/Jacob's Scene.unity index 1ed4417..3ffc1be 100644 --- a/Assets/Scenes/Jacob's Scene.unity +++ b/Assets/Scenes/Jacob's Scene.unity @@ -859,7 +859,7 @@ BoxCollider2D: adaptiveTiling: 0 m_AutoTiling: 0 serializedVersion: 2 - m_Size: {x: 2, y: 9} + m_Size: {x: 4, y: 9} m_EdgeRadius: 0 --- !u!114 &701830246 MonoBehaviour: @@ -1148,6 +1148,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: controller: {fileID: 790075221} + animator: {fileID: 0} runSpeed: 40 --- !u!58 &790075218 CircleCollider2D: @@ -1234,6 +1235,8 @@ MonoBehaviour: m_GroundCheck: {fileID: 1772079924} m_CeilingCheck: {fileID: 772189788} m_CrouchDisableCollider: {fileID: 790075219} + m_Grounded: 0 + m_Velocity: {x: 0, y: 0, z: 0} OnLandEvent: m_PersistentCalls: m_Calls: [] @@ -1583,7 +1586,7 @@ SpriteRenderer: m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} m_SortingLayerID: 1027733709 - m_SortingLayer: 1 + m_SortingLayer: 2 m_SortingOrder: 0 m_Sprite: {fileID: 21300000, guid: f1a2cb3f7f820294b8bf45a3cf11e89a, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} @@ -2127,7 +2130,7 @@ BoxCollider2D: adaptiveTiling: 0 m_AutoTiling: 0 serializedVersion: 2 - m_Size: {x: 4, y: 116} + m_Size: {x: 4, y: 16} m_EdgeRadius: 0 --- !u!114 &1880558047 MonoBehaviour: diff --git a/Assets/UpdatedWallTrigger.cs b/Assets/UpdatedWallTrigger.cs index 173e687..075ecd7 100644 --- a/Assets/UpdatedWallTrigger.cs +++ b/Assets/UpdatedWallTrigger.cs @@ -29,29 +29,38 @@ public class UpdatedWallTrigger : MonoBehaviour { var rayAngle = Quaternion.AngleAxis((360f / angleStep) * i, target.forward) * Vector3.left; hit = Physics2D.Raycast(target.position, rayAngle, rayLength, layerMask); - float xe = Mathf.Abs(hit.point.x - target.position.x); - float ye = hit.point.y; - float goalx = Mathf.Abs(target.localPosition.x / box.size.x); + float xe = Mathf.Abs(hit.point.x - target.localPosition.x); + float ye = Mathf.Abs(hit.point.y - target.position.y); + float goalx = Mathf.Abs(target.position.x * box.size.x) ; + float goaly = Mathf.Abs(target.position.x * box.size.x); if (hit && counter >=150) { - if (xe >= goalx) + if (xe >= 44 && xe <50) { Debug.Log("Counter Right "+counter); - Debug.Log(xe); Debug.Log("XE " + xe); - Debug.Log("Goal " + goalx); - camMove.transform.position = new Vector3(camMove.transform.position.x - 22f, camMove.transform.position.y, -1.3f); - catMove.transform.position = new Vector3(catMove.transform.position.x - 10f, catMove.transform.position.y+1f, 0); + Debug.Log("Goaly " + goaly); + Debug.Log(target.position.y * box.size.y); + camMove.transform.position = new Vector3(camMove.transform.position.x + 22f, camMove.transform.position.y, -1.3f); + catMove.transform.position = new Vector3(catMove.transform.position.x + 10f, catMove.transform.position.y+1f, 0); + xe = 0; + ye = 0; + goalx = 0; + goaly = 0; counter = 0; } - else if (xe < goalx) + else if (xe >=50) { Debug.Log("Counter Left " + counter); - Debug.Log("XE "+xe); - Debug.Log("Goal "+ goalx); - camMove.transform.position = new Vector3(camMove.transform.position.x + 22f, 0,-1.3f); - catMove.transform.position = new Vector3(catMove.transform.position.x + 10f, catMove.transform.position.y +1f,0); + Debug.Log("XE "+ye); + Debug.Log("Goaly "+ goaly); + camMove.transform.position = new Vector3(camMove.transform.position.x - 22f, catMove.transform.position.y + 1.0f,-1.3f); + catMove.transform.position = new Vector3(catMove.transform.position.x - 10f, catMove.transform.position.y ,0); counter = 0; + xe = 0; + ye = 0; + goalx = 0; + goaly = 0; } } counter++;