40 lines
824 B
C#
40 lines
824 B
C#
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public class SoftLockPreventer : MonoBehaviour
|
||
|
{
|
||
|
public GameObject toDeactivate;
|
||
|
// Start is called before the first frame update
|
||
|
void Start()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
|
||
|
// Update is called once per frame
|
||
|
void Update()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
|
||
|
private void OnTriggerEnter2D(Collider2D other)
|
||
|
{
|
||
|
Debug.Log("SoftLockPreventer: Deactivated");
|
||
|
if (other.gameObject.CompareTag("Player"))
|
||
|
{
|
||
|
toDeactivate.SetActive(false);
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void OnTriggerExit2D(Collider2D other)
|
||
|
{
|
||
|
Debug.Log("SoftLockPreventer: Activated");
|
||
|
if (other.gameObject.CompareTag("Player"))
|
||
|
{
|
||
|
toDeactivate.SetActive(true);
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|