diff options
Diffstat (limited to 'Assets/Scripts/SoulCoreGameLoop/UI/AreaHint.cs')
| -rw-r--r-- | Assets/Scripts/SoulCoreGameLoop/UI/AreaHint.cs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/Assets/Scripts/SoulCoreGameLoop/UI/AreaHint.cs b/Assets/Scripts/SoulCoreGameLoop/UI/AreaHint.cs index ab03647..6b676fe 100644 --- a/Assets/Scripts/SoulCoreGameLoop/UI/AreaHint.cs +++ b/Assets/Scripts/SoulCoreGameLoop/UI/AreaHint.cs @@ -1,31 +1,31 @@ using System; -using TMPro; -using UnityEditor; using UnityEngine; +using TMPro; namespace SoulCoreGameLoop.UI { [RequireComponent(typeof(Animator))] public class AreaHint : MonoBehaviour, IUIEventSender<AreaHintMessage> { - private const String TriggerPlay = "Play"; + private static readonly int TriggerPlay = Animator.StringToHash("Play"); public TMP_Text areaName; private Animator _animator; - [InitializeOnLoadMethod] - public static void RegisterListener () - => UIEventListener.JoinListener<AreaHintMessage>(); - - public void OnReceive(AreaHintMessage evt) + private void Awake() { - areaName.text = evt.AreaName; - _animator.Play(TriggerPlay); + _animator = GetComponent<Animator>(); + UIEventListener.Register(this); } + + private void OnDestroy() + => UIEventListener.Unregister<AreaHintMessage>(); + - private void Start() + public void OnReceive(AreaHintMessage evt) { - _animator = GetComponent<Animator>(); + areaName.text = evt.AreaName; + _animator.SetTrigger(TriggerPlay); } } @@ -38,4 +38,4 @@ namespace SoulCoreGameLoop.UI AreaName = areaName; } } -} +}
\ No newline at end of file |
