game(scripts/af): rename jump to leap

geddit... leap of faith... ha... ha...
This commit is contained in:
Mark Joshwel 2024-08-10 15:04:02 +08:00
parent 11f36b94aa
commit 3b7ed3694b
4 changed files with 48 additions and 8 deletions

View file

@ -4,6 +4,7 @@
* description: trigger to detect if the player did not land in an aerial faith landing trigger
*/
using System;
using UnityEngine;
/// <summary>
@ -14,7 +15,17 @@ public class AerialFaithDeathTrigger : MonoBehaviour
/// <summary>
/// the trigger that detects if the player has jumped out of the play area
/// </summary>
[SerializeField] private AerialFaithJumpTrigger linkedJumpTrigger;
[SerializeField] private AerialFaithLeapTrigger linkedLeapTrigger;
/// <summary>
/// check if linkedLeapTrigger is set
/// </summary>
/// <exception cref="NullReferenceException">consequential exception</exception>
private void Awake()
{
if (linkedLeapTrigger == null)
throw new NullReferenceException("AerialFaithLandingTrigger: linkedLeapTrigger is not set");
}
/// <summary>
/// detect if player has entered the trigger
@ -22,8 +33,24 @@ public class AerialFaithDeathTrigger : MonoBehaviour
/// <param name="other">colliding game object</param>
private void OnTriggerEnter(Collider other)
{
if (!other.CompareTag("Player") || !linkedJumpTrigger.isPlayerInAir) return;
// Debug.Log($"AerialFaithDeathTrigger: was hit by object with tag {other.tag}");
if (!other.CompareTag("Player") || !linkedLeapTrigger.isPlayerInAir) return;
// if (!other.CompareTag("Player"))
// {
// Debug.Log("AerialFaithDeathTrigger: player missed");
// return;
// }
//
// if (!linkedLeapTrigger.isPlayerInAir)
// {
// Debug.Log("AerialFaithDeathTrigger: player is in an invalid state");
// return;
// }
Debug.Log("AerialFaithDeathTrigger: player missed, and will be baked");
linkedLeapTrigger.isPlayerInAir = false;
// TODO: kill player
}
}

View file

@ -4,6 +4,7 @@
* description: trigger to detect if the player landed in a specific area
*/
using System;
using UnityEngine;
/// <summary>
@ -14,7 +15,17 @@ public class AerialFaithLandingTrigger : MonoBehaviour
/// <summary>
/// the trigger that detects if the player has jumped out of the play area
/// </summary>
[SerializeField] private AerialFaithJumpTrigger linkedJumpTrigger;
[SerializeField] private AerialFaithLeapTrigger linkedLeapTrigger;
/// <summary>
/// check if linkedLeapTrigger is set
/// </summary>
/// <exception cref="NullReferenceException">consequential exception</exception>
private void Awake()
{
if (linkedLeapTrigger == null)
throw new NullReferenceException("AerialFaithLandingTrigger: linkedLeapTrigger is not set");
}
/// <summary>
/// detect if player has entered the trigger
@ -22,8 +33,9 @@ public class AerialFaithLandingTrigger : MonoBehaviour
/// <param name="other">colliding game object</param>
private void OnTriggerEnter(Collider other)
{
if (!other.CompareTag("Player") || !linkedJumpTrigger.isPlayerInAir) return;
// Debug.Log($"AerialFaithLandingTrigger: was hit by object with tag {other.tag}");
if (!other.CompareTag("Player") || !linkedLeapTrigger.isPlayerInAir) return;
Debug.Log("AerialFaithLandingTrigger: player landed");
linkedJumpTrigger.isPlayerInAir = false;
linkedLeapTrigger.isPlayerInAir = false;
}
}

View file

@ -9,7 +9,7 @@
/// <summary>
/// detection behaviour class
/// </summary>
public class AerialFaithJumpTrigger : MonoBehaviour
public class AerialFaithLeapTrigger : MonoBehaviour
{
/// <summary>
/// bool to check if player is airborne
@ -22,7 +22,8 @@ public class AerialFaithJumpTrigger : MonoBehaviour
/// <param name="other">colliding game object</param>
private void OnTriggerExit(Collider other)
{
if (other.CompareTag("Player")) isPlayerInAir = true;
Debug.Log("AerialFaithJumpTrigger: player is airborne");
if (!other.CompareTag("Player")) return;
isPlayerInAir = true;
Debug.Log("AerialFaithLeapTrigger: player is airborne");
}
}