game(scripts): add aerial faith detection scripts

wheeeeeeeee!
This commit is contained in:
Mark Joshwel 2024-08-10 13:19:04 +08:00
parent 5d4583caca
commit f1eaf08b23
6 changed files with 106 additions and 0 deletions

View file

@ -0,0 +1,24 @@
/*
* 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;
/// <summary>
/// detection behaviour class
/// </summary>
public class AerialFaithDeathTrigger : MonoBehaviour
{
/// <summary>
/// detect if player has entered the trigger
/// </summary>
/// <param name="other">colliding game object</param>
private void OnTriggerEnter(Collider other)
{
if (!other.CompareTag("Player")) return;
Debug.Log("AerialFaithDeathTrigger: player will be kil");
// TODO: kill player
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 7d5a9cf332774b06a7a334f98b8b2014
timeCreated: 1723266227

View file

@ -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;
/// <summary>
/// detection behaviour class
/// </summary>
public class AerialFaithJumpTrigger : MonoBehaviour
{
/// <summary>
/// bool to check if player is airborne
/// </summary>
public bool isPlayerInAir;
/// <summary>
/// detect if player has jumped out of the trigger
/// </summary>
/// <param name="other">colliding game object</param>
private void OnTriggerExit(Collider other)
{
if (other.CompareTag("Player")) isPlayerInAir = true;
Debug.Log("AerialFaithJumpTrigger: player is airborne");
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 27200cbaa7196664b96b3c786389d7eb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -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;
/// <summary>
/// detection behaviour class
/// </summary>
public class AerialFaithLandingTrigger : MonoBehaviour
{
/// <summary>
/// the trigger that detects if the player has jumped out of the play area
/// </summary>
[SerializeField] private AerialFaithJumpTrigger linkedJumpTrigger;
/// <summary>
/// detect if player has entered the trigger
/// </summary>
/// <param name="other">colliding game object</param>
private void OnTriggerEnter(Collider other)
{
if (!other.CompareTag("Player") || !linkedJumpTrigger.isPlayerInAir) return;
Debug.Log("AerialFaithLandingTrigger: player landed");
linkedJumpTrigger.isPlayerInAir = false;
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a8b674965ae7094458813aa68d06bb78
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: