using UnityEngine; using Unheimlich.Core.Events; namespace Unheimlich.Features.Hallucination { /// /// Fires a GameEventTrigger (and therefore a HallucinationTrigger) when the player /// enters a physics trigger collider. Pair with GameEventTrigger + HallucinationTrigger /// on the same GameObject. /// [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(); } protected override void OnPlayerEntered(Collider playerCollider) { _eventTrigger.Fire(); } } }