mirror of
https://udrimavric.com/MAVRIC/Stratasys-450mc-VR.git
synced 2025-01-23 07:38:33 -05:00
41 lines
1003 B
C#
41 lines
1003 B
C#
|
using System;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using SO;
|
||
|
using SO.Channels;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public class ToggleObjectOff : MonoBehaviour
|
||
|
{
|
||
|
[SerializeField] private StepChangeChannelSO stepChangeChannel;
|
||
|
[SerializeField] private SimpleChannelSO previousStepChannel;
|
||
|
[SerializeField] private List<GameObject> objectToDisable;
|
||
|
private void OnEnable()
|
||
|
{
|
||
|
stepChangeChannel.OnStepChanged += OnStepChanged;
|
||
|
previousStepChannel.OnEventRaised += ResetObjects;
|
||
|
}
|
||
|
|
||
|
private void OnDisable()
|
||
|
{
|
||
|
stepChangeChannel.OnStepChanged -= OnStepChanged;
|
||
|
previousStepChannel.OnEventRaised -= ResetObjects;
|
||
|
}
|
||
|
|
||
|
private void OnStepChanged(StepSO step)
|
||
|
{
|
||
|
foreach (GameObject item in objectToDisable)
|
||
|
{
|
||
|
item.SetActive(false);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void ResetObjects()
|
||
|
{
|
||
|
foreach (GameObject item in objectToDisable)
|
||
|
{
|
||
|
item.SetActive(false);
|
||
|
}
|
||
|
}
|
||
|
}
|