31 lines
553 B
C#
31 lines
553 B
C#
using UnityEngine;
|
|
|
|
public class GenerateArea : MonoBehaviour
|
|
{
|
|
public bool playerInArea = false;
|
|
|
|
void OnTriggerEnter(Collider other)
|
|
{
|
|
if (other.CompareTag("Player"))
|
|
{
|
|
Debug.Log("OnTriggerEnter");
|
|
playerInArea = true;
|
|
}
|
|
}
|
|
|
|
void OnTriggerExit(Collider other)
|
|
{
|
|
if (other.CompareTag("Player"))
|
|
{
|
|
Debug.Log("OnTriggerExit");
|
|
playerInArea = false;
|
|
}
|
|
}
|
|
|
|
public bool IsPlayerInArea()
|
|
{
|
|
return playerInArea;
|
|
}
|
|
}
|
|
|