From 11f36b94aacbb76dba2ca3a325652d80fb7523dd Mon Sep 17 00:00:00 2001 From: Mark Joshwel Date: Sat, 10 Aug 2024 13:20:53 +0800 Subject: [PATCH] game(scripts): add aerial faith detection scripts wheeeeeeeee! --- .../Assets/Scripts/AerialFaithDeathTrigger.cs | 29 +++++++++++++++++++ .../Scripts/AerialFaithDeathTrigger.cs.meta | 3 ++ .../Assets/Scripts/AerialFaithJumpTrigger.cs | 28 ++++++++++++++++++ .../Scripts/AerialFaithJumpTrigger.cs.meta | 11 +++++++ .../Scripts/AerialFaithLandingTrigger.cs | 29 +++++++++++++++++++ .../Scripts/AerialFaithLandingTrigger.cs.meta | 11 +++++++ 6 files changed, 111 insertions(+) create mode 100644 RunningLateGame/Assets/Scripts/AerialFaithDeathTrigger.cs create mode 100644 RunningLateGame/Assets/Scripts/AerialFaithDeathTrigger.cs.meta create mode 100644 RunningLateGame/Assets/Scripts/AerialFaithJumpTrigger.cs create mode 100644 RunningLateGame/Assets/Scripts/AerialFaithJumpTrigger.cs.meta create mode 100644 RunningLateGame/Assets/Scripts/AerialFaithLandingTrigger.cs create mode 100644 RunningLateGame/Assets/Scripts/AerialFaithLandingTrigger.cs.meta diff --git a/RunningLateGame/Assets/Scripts/AerialFaithDeathTrigger.cs b/RunningLateGame/Assets/Scripts/AerialFaithDeathTrigger.cs new file mode 100644 index 0000000..9172704 --- /dev/null +++ b/RunningLateGame/Assets/Scripts/AerialFaithDeathTrigger.cs @@ -0,0 +1,29 @@ +/* + * author: mark joshwel + * date: 10/8/2024 + * description: trigger to detect if the player did not land in an aerial faith landing trigger + */ + +using UnityEngine; + +/// +/// detection behaviour class +/// +public class AerialFaithDeathTrigger : MonoBehaviour +{ + /// + /// the trigger that detects if the player has jumped out of the play area + /// + [SerializeField] private AerialFaithJumpTrigger linkedJumpTrigger; + + /// + /// detect if player has entered the trigger + /// + /// colliding game object + private void OnTriggerEnter(Collider other) + { + if (!other.CompareTag("Player") || !linkedJumpTrigger.isPlayerInAir) return; + Debug.Log("AerialFaithDeathTrigger: player missed, and will be baked"); + // TODO: kill player + } +} \ No newline at end of file diff --git a/RunningLateGame/Assets/Scripts/AerialFaithDeathTrigger.cs.meta b/RunningLateGame/Assets/Scripts/AerialFaithDeathTrigger.cs.meta new file mode 100644 index 0000000..e11ac40 --- /dev/null +++ b/RunningLateGame/Assets/Scripts/AerialFaithDeathTrigger.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 7d5a9cf332774b06a7a334f98b8b2014 +timeCreated: 1723266227 \ No newline at end of file diff --git a/RunningLateGame/Assets/Scripts/AerialFaithJumpTrigger.cs b/RunningLateGame/Assets/Scripts/AerialFaithJumpTrigger.cs new file mode 100644 index 0000000..3d5809f --- /dev/null +++ b/RunningLateGame/Assets/Scripts/AerialFaithJumpTrigger.cs @@ -0,0 +1,28 @@ +/* + * author: mark joshwel + * date: 10/8/2024 + * description: trigger to detect if the player has jumped out of play area + */ + +using UnityEngine; + +/// +/// detection behaviour class +/// +public class AerialFaithJumpTrigger : MonoBehaviour +{ + /// + /// bool to check if player is airborne + /// + public bool isPlayerInAir; + + /// + /// detect if player has jumped out of the trigger + /// + /// colliding game object + private void OnTriggerExit(Collider other) + { + if (other.CompareTag("Player")) isPlayerInAir = true; + Debug.Log("AerialFaithJumpTrigger: player is airborne"); + } +} \ No newline at end of file diff --git a/RunningLateGame/Assets/Scripts/AerialFaithJumpTrigger.cs.meta b/RunningLateGame/Assets/Scripts/AerialFaithJumpTrigger.cs.meta new file mode 100644 index 0000000..bc87e9b --- /dev/null +++ b/RunningLateGame/Assets/Scripts/AerialFaithJumpTrigger.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 27200cbaa7196664b96b3c786389d7eb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/RunningLateGame/Assets/Scripts/AerialFaithLandingTrigger.cs b/RunningLateGame/Assets/Scripts/AerialFaithLandingTrigger.cs new file mode 100644 index 0000000..13d0397 --- /dev/null +++ b/RunningLateGame/Assets/Scripts/AerialFaithLandingTrigger.cs @@ -0,0 +1,29 @@ +/* + * author: mark joshwel + * date: 10/8/2024 + * description: trigger to detect if the player landed in a specific area + */ + +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 AerialFaithJumpTrigger linkedJumpTrigger; + + /// + /// detect if player has entered the trigger + /// + /// colliding game object + private void OnTriggerEnter(Collider other) + { + if (!other.CompareTag("Player") || !linkedJumpTrigger.isPlayerInAir) return; + Debug.Log("AerialFaithLandingTrigger: player landed"); + linkedJumpTrigger.isPlayerInAir = false; + } +} \ No newline at end of file diff --git a/RunningLateGame/Assets/Scripts/AerialFaithLandingTrigger.cs.meta b/RunningLateGame/Assets/Scripts/AerialFaithLandingTrigger.cs.meta new file mode 100644 index 0000000..966c0db --- /dev/null +++ b/RunningLateGame/Assets/Scripts/AerialFaithLandingTrigger.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a8b674965ae7094458813aa68d06bb78 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: