using System; using System.Collections.Generic; using EscapeRoomEngine.Engine.Runtime.Modules; using NaughtyAttributes; using UnityEngine; namespace EscapeRoomEngine.Desert.Runtime.Puzzle_A { [RequireComponent(typeof(Animator))] public class Terminal : PuzzleState { private static readonly int LightFlash = Animator.StringToHash("Light Flash"); [BoxGroup("Internal")] [Required] public Emission terminalLight; [BoxGroup("Internal")] public List symbols; private Animator _animator; private void Awake() { _animator = GetComponent(); } private void Start() { PuzzleEvent += (_, type) => { switch (type) { case PuzzleEventType.Restarted: terminalLight.color = theme.puzzleColor; symbols.ForEach(symbol => symbol.Enable()); break; case PuzzleEventType.Solved: terminalLight.color = theme.solvedColor; symbols.ForEach(symbol => symbol.Disable()); break; case PuzzleEventType.WrongInput: terminalLight.color = theme.puzzleColor; _animator.SetTrigger(LightFlash); break; default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } }; TurnOnRingLight(); } public void TurnOnRingLight() { terminalLight.active = true; } public void TurnOffRingLight() { terminalLight.active = false; } } }