Added Ray scanning

Adds ray scanning which detects walls and currently triggers / platforms as well, needs to be fixed but should be an easy layer fix.
This commit is contained in:
Unknown committed 2022-02-21 22:10:15 -06:00
1 parent 43e756be25
commit 5e594b144d
7 files changed
+1341 -20

No files matched your search

+14 -12
View File
@@ -19,31 +19,33 @@ public class WallTrigger : MonoBehaviour
// Update is called once per frame
void Update()
{
if (entered && counter >=150)
{
cam.transform.position -= moveCam;
cat.transform.position -= moveCat;
entered = false;
}
else
{
counter++;
}
counter++;
}
void OnTriggerEnter2D(Collider2D col)
{
if (!entered)
if (!entered && counter >= 120)
{
entered = true;
Debug.Log("Trigger detected");
//Debug.Log("Move Cam Right");
cam.transform.position += moveCam;
cat.transform.position += moveCat;
Debug.Log(counter);
counter = 0;
//PlayerMovement.ChangePos(1, 2);
}
else if (counter >= 120 && entered)
{
//Debug.Log("Moved cam left");
Debug.Log(counter);
cam.transform.position -= moveCam;
cat.transform.position -= moveCat;
entered = false;
counter = 0;
}
}
/*void Interact(Collider2D col, ){