/* * author: mark joshwel * date: 10/8/2024 * description: trigger to detect if the player landed in a specific area */ using System; using UnityEngine; /// /// detection behaviour class /// public class AerialFaithLandingTrigger : MonoBehaviour { /// /// the trigger that detects if the player has jumped out of the play area /// [SerializeField] private AerialFaithLeapTrigger linkedLeapTrigger; /// /// check if linkedLeapTrigger is set /// /// consequential exception private void Awake() { if (linkedLeapTrigger == null) throw new NullReferenceException("AerialFaithLandingTrigger: linkedLeapTrigger is not set"); } /// /// detect if player has entered the trigger /// /// colliding game object private void OnTriggerEnter(Collider other) { // Debug.Log($"AerialFaithLandingTrigger: was hit by object with tag {other.tag}"); if (!other.CompareTag("Player") || !linkedLeapTrigger.isPlayerInAir) return; Debug.Log("AerialFaithLandingTrigger: player landed"); linkedLeapTrigger.isPlayerInAir = false; } }