1
0
mirror of https://projects.caleb-brown.dev/UDRI-XRT/UDRIGEEKCup2024.git synced 2025-01-22 15:18:25 -05:00
UDRIGEEKCup2024/Assets/Scripts/OnColliderTrigger.cs
2024-04-16 16:23:46 -04:00

30 lines
788 B
C#

using UnityEngine;
using UnityEngine.Events;
namespace MAVRIC.GEEKCup
{
public class OnColliderTrigger : MonoBehaviour
{
public bool invertResult = false;
// TODO: Update this to use a UnityAtoms BoolReference
[SerializeField] private UnityEvent<bool> onTrigger;
private void OnTriggerEnter(Collider other)
{
// TODO: Update this to a different system
if (other.CompareTag("Player"))
{
onTrigger?.Invoke(!invertResult);
}
}
private void OnTriggerExit(Collider other)
{
if (other.CompareTag("Player"))
{
onTrigger?.Invoke(invertResult);
}
}
}
}