Files
Adventures-of-Kirby/Assets/_Project/Scripts/Story/StoryTrigger.cs
T
ifontosh 1c6c9b2a70 Initial Unity 6 scaffold for Cat Kirby Adventures.
Add Phase A greybox vertical slice: third-person movement, forest path, checkpoints, story triggers, and light ability gate.
2026-09-08 17:09:27 +08:00

28 lines
761 B
C#

using UnityEngine;
namespace KirbyAdventures
{
[RequireComponent(typeof(Collider))]
public class StoryTrigger : MonoBehaviour
{
[TextArea] public string Quote;
public float DisplaySeconds = 4.5f;
public bool Once = true;
bool _shown;
void OnTriggerEnter(Collider other)
{
if (Once && _shown) return;
if (other.GetComponent<PlayerMotor>() == null) return;
_shown = true;
DialogueUI.ShowTemporary(Quote, DisplaySeconds);
}
void OnTriggerExit(Collider other)
{
if (other.GetComponent<PlayerMotor>() == null) return;
// Optional: hide early when leaving — keep simple, let timer finish
}
}
}