mirror of
https://udrimavric.com/MAVRIC/Stratasys-450mc-VR.git
synced 2025-01-23 07:38:33 -05:00
33 lines
941 B
C#
33 lines
941 B
C#
|
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();
|
||
|
}
|
||
|
}
|
||
|
}
|