mirror of
https://github.com/frizbee19/FebGameJam.git
synced 2026-09-11 08:17:01 +00:00
Added a Move onto next area in crowds :) 👍
read title.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class MoveOnToNextAreaScript : Trigger
|
||||
{
|
||||
GameObject instance;
|
||||
bool isTrigger = false;
|
||||
public BoxCollider2D box;
|
||||
|
||||
public override void Action()
|
||||
{
|
||||
isTrigger = true;
|
||||
box.isTrigger = true;
|
||||
Debug.Log(isTrigger);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 87e68b3571595ec4cbb4ac2904f27bae
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -22,7 +22,7 @@ public abstract class Trigger : MonoBehaviour
|
||||
//checks if player is in range of the trigger
|
||||
private void OnTriggerStay2D(Collider2D other) {
|
||||
if(other.CompareTag("Player")) {
|
||||
Debug.Log("entered");
|
||||
//Debug.Log("entered");
|
||||
isActive = true;
|
||||
}
|
||||
// else {
|
||||
@@ -39,7 +39,7 @@ public abstract class Trigger : MonoBehaviour
|
||||
private void OnTriggerExit2D(Collider2D other) {
|
||||
if(other.CompareTag("Player")) {
|
||||
isActive = false;
|
||||
Debug.Log("exit");
|
||||
//Debug.Log("exit");
|
||||
}
|
||||
if(forceInteract && repeatable) {
|
||||
hasOccurred = false;
|
||||
@@ -65,7 +65,7 @@ public abstract class Trigger : MonoBehaviour
|
||||
else
|
||||
{
|
||||
if(Input.GetKeyDown(KeyCode.E)) {
|
||||
Debug.Log("action");
|
||||
//Debug.Log("action");
|
||||
Action();
|
||||
if(!repeatable)
|
||||
{
|
||||
|
||||
@@ -31,18 +31,18 @@ public class WorkingWallTrigger : MonoBehaviour
|
||||
}
|
||||
void OnTriggerEnter2D(Collider2D col)
|
||||
{
|
||||
float ye = cat.transform.position.y;
|
||||
float goaly = box.transform.localPosition.y;
|
||||
if (ye < goaly && counter >= countOffset && col.IsTouchingLayers(layerMask))
|
||||
{
|
||||
cam.transform.position -= moveCam;
|
||||
cat.transform.position -= moveCat;
|
||||
counter = 0;
|
||||
}
|
||||
else if (ye >= goaly && counter > countOffset && col.IsTouchingLayers(layerMask))
|
||||
float xe = cat.transform.position.x;
|
||||
float goalx = box.transform.localPosition.x;
|
||||
if (xe < goalx && counter >= countOffset)
|
||||
{
|
||||
cam.transform.position += moveCam;
|
||||
cat.transform.position += moveCat;
|
||||
counter = 0;
|
||||
}
|
||||
else if (xe >= goalx && counter > countOffset)
|
||||
{
|
||||
cam.transform.position -= moveCam;
|
||||
cat.transform.position -= moveCat;
|
||||
|
||||
counter = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user