Stratasys-450mc-VR/Assets/Scripts/StepDescription.cs
2023-11-01 10:51:29 -04:00

35 lines
824 B
C#
Executable File

using SO;
using SO.Channels;
using TMPro;
using UnityEngine;
public class StepDescription : MonoBehaviour
{
[SerializeField] private StepChangeChannelSO stepChangeChannel;
[SerializeField] private SimpleChannelSO stepDescriptionLoaded;
[SerializeField] private TMP_Text label;
private void OnEnable()
{
stepChangeChannel.OnStepChanged += OnStepChanged;
}
private void OnDisable()
{
stepChangeChannel.OnStepChanged -= OnStepChanged;
}
private void OnStepChanged(StepSO arg0)
{
if (label is null)
{
Debug.LogError($"{nameof(label)} is null...", this.gameObject);
return;
}
label.SetText(arg0.Description);
stepDescriptionLoaded.RaiseEvent();
}
}