using SO; using SO.Channels; using UnityEngine; using UnityEngine.UI; namespace Managers { public class DocumentManager : MonoBehaviour { [SerializeField] private StepChangeChannelSO stepChangeChannel; [SerializeField] private SimpleChannelSO documentLoadedChannel; [SerializeField] private Material currentImage; private const string MainText = "_MainTex"; private static readonly int MainTex = Shader.PropertyToID(MainText); private void OnEnable() { stepChangeChannel.OnStepChanged += OnStepChanged; } private void OnDisable() { stepChangeChannel.OnStepChanged -= OnStepChanged; } private void OnStepChanged(StepSO step) { currentImage.SetTexture(MainTex, step.Document); documentLoadedChannel.RaiseEvent(); } } }