+ Add : Plugin fbx integration
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unheimlich.World.Environment
|
||||
{
|
||||
/// <summary>
|
||||
/// Placed on the trigger child of an <see cref="InfiniteStaircaseController"/>.
|
||||
/// Forwards Player trigger enter / exit events to the parent controller.
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(Collider))]
|
||||
public class StaircaseTriggerZone : MonoBehaviour
|
||||
{
|
||||
private const string PlayerTag = "Player";
|
||||
|
||||
private InfiniteStaircaseController _controller;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_controller = GetComponentInParent<InfiniteStaircaseController>();
|
||||
|
||||
if (_controller == null)
|
||||
Debug.LogWarning($"[StaircaseTriggerZone] No InfiniteStaircaseController found in parent of '{name}'.", this);
|
||||
}
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (_controller == null) return;
|
||||
if (!other.CompareTag(PlayerTag)) return;
|
||||
|
||||
_controller.OnPlayerEnteredTrigger();
|
||||
}
|
||||
|
||||
private void OnTriggerExit(Collider other)
|
||||
{
|
||||
if (_controller == null) return;
|
||||
if (!other.CompareTag(PlayerTag)) return;
|
||||
|
||||
_controller.OnPlayerExitedTrigger();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user