puzzle a terminal module
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
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;
|
||||
|
||||
private Animator _animator;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_animator = GetComponent<Animator>();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
PuzzleEvent += (_, type) =>
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case PuzzleEventType.Restarted:
|
||||
light.color = theme.puzzleColor;
|
||||
break;
|
||||
case PuzzleEventType.Solved:
|
||||
light.color = theme.solvedColor;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user