mirror of
https://github.com/frizbee19/FebGameJam.git
synced 2026-09-11 08:17:01 +00:00
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:
1 parent
43e756be25
commit
5e594b144d
7 files changed
+1341
-20
No files matched your search
@@ -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, ){
|
||||
|
||||
Reference in new issue
Block a user