diff options
Diffstat (limited to 'Assets/Scripts/SoulCoreGameLoop/UI/AreaHint.cs')
| -rw-r--r-- | Assets/Scripts/SoulCoreGameLoop/UI/AreaHint.cs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Assets/Scripts/SoulCoreGameLoop/UI/AreaHint.cs b/Assets/Scripts/SoulCoreGameLoop/UI/AreaHint.cs new file mode 100644 index 0000000..ab03647 --- /dev/null +++ b/Assets/Scripts/SoulCoreGameLoop/UI/AreaHint.cs @@ -0,0 +1,41 @@ +using System; +using TMPro; +using UnityEditor; +using UnityEngine; + +namespace SoulCoreGameLoop.UI +{ + [RequireComponent(typeof(Animator))] + public class AreaHint : MonoBehaviour, IUIEventSender<AreaHintMessage> + { + private const String TriggerPlay = "Play"; + + public TMP_Text areaName; + private Animator _animator; + + [InitializeOnLoadMethod] + public static void RegisterListener () + => UIEventListener.JoinListener<AreaHintMessage>(); + + public void OnReceive(AreaHintMessage evt) + { + areaName.text = evt.AreaName; + _animator.Play(TriggerPlay); + } + + private void Start() + { + _animator = GetComponent<Animator>(); + } + } + + public struct AreaHintMessage + { + public readonly string AreaName; + + public AreaHintMessage(string areaName) + { + AreaName = areaName; + } + } +} |
