Files
Ipseity-Demo/Assets/Unheimlich_POC/Scripts/Features/Hallucination/Runtime/HallucinationTriggerZone.cs
T
2026-03-16 17:06:47 +01:00

35 lines
1.0 KiB
C#

using UnityEngine;
using Unheimlich.Core.Events;
namespace Unheimlich.Features.Hallucination
{
/// <summary>
/// Fires a GameEventTrigger (and therefore a HallucinationTrigger) when the player
/// enters a physics trigger collider. Pair with GameEventTrigger + HallucinationTrigger
/// on the same GameObject.
/// </summary>
[RequireComponent(typeof(GameEventTrigger))]
public class HallucinationTriggerZone : TriggerZoneBase
{
[Header("Zone Behaviour")]
[Tooltip("Allow the zone to fire again after the player exits and re-enters")]
[SerializeField] private bool _retriggerable = false;
protected override bool IsRetriggerable => _retriggerable;
private GameEventTrigger _eventTrigger;
protected override void Awake()
{
base.Awake();
_eventTrigger = GetComponent<GameEventTrigger>();
}
protected override void OnPlayerEntered(Collider playerCollider)
{
_eventTrigger.Fire();
}
}
}