It works because hard corder very odd but yeah

it works sorta yeah sorta.
This commit is contained in:
Unknown committed 2022-02-25 05:23:03 -06:00
1 parent 6d43681db6
commit 1cea56dbad
2 files changed
+28 -16

No files matched your search

+6 -3
View File
@@ -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:
+22 -13
View File
@@ -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++;