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 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); } } }