Files

34 lines
848 B
C#

using UnityEngine;
namespace NightclubArcadia.Skills
{
[RequireComponent(typeof(Collider))]
public sealed class CommentaryTrigger : MonoBehaviour
{
[SerializeField] string contextId;
[SerializeField] bool repeatable;
[SerializeField] string playerTag = "Player";
void OnTriggerEnter(Collider other)
{
if (string.IsNullOrEmpty(contextId))
{
return;
}
if (!string.IsNullOrEmpty(playerTag) && !other.CompareTag(playerTag))
{
return;
}
var runtime = SkillRuntime.Instance;
if (runtime == null || runtime.Commentary == null)
{
return;
}
runtime.Commentary.RequestCommentary(contextId, repeatable);
}
}
}