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