Hallucination system
This commit is contained in:
+34
@@ -0,0 +1,34 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user