Added Walls and Triggers for Wallso

The walls update tm
This commit is contained in:
Unknown
2022-02-21 16:28:21 -06:00
parent 4ee32def84
commit 43e756be25
7 changed files with 339 additions and 40 deletions
@@ -0,0 +1,52 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WallTrigger : MonoBehaviour
{
bool entered = false;
public GameObject cam;
public GameObject cat;
private int counter = 0;
private Vector3 moveCam = new Vector3(20,0,0);
private Vector3 moveCat = new Vector3(4,0,0);
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (entered && counter >=150)
{
cam.transform.position -= moveCam;
cat.transform.position -= moveCat;
entered = false;
}
else
{
counter++;
}
}
void OnTriggerEnter2D(Collider2D col)
{
if (!entered)
{
entered = true;
Debug.Log("Trigger detected");
cam.transform.position += moveCam;
cat.transform.position += moveCat;
Debug.Log(counter);
counter = 0;
//PlayerMovement.ChangePos(1, 2);
}
}
/*void Interact(Collider2D col, ){
*
}*/
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9e34ddf7efd0cb44ba69abc06b6567d4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: