relate terminal and ball
This commit is contained in:
@@ -1,58 +1,13 @@
|
||||
using System;
|
||||
using EscapeRoomEngine.Engine.Runtime.Modules;
|
||||
using EscapeRoomEngine.Engine.Runtime.Modules;
|
||||
using NaughtyAttributes;
|
||||
using UnityEngine;
|
||||
|
||||
namespace EscapeRoomEngine.Desert.Runtime.Puzzle_A
|
||||
{
|
||||
[RequireComponent(typeof(Animator))]
|
||||
public class Ball : PuzzleState
|
||||
public class Ball : ModuleState
|
||||
{
|
||||
private static readonly int LightFlash = Animator.StringToHash("Light Flash");
|
||||
|
||||
[BoxGroup("Internal")] [Required] public Emission ringLight;
|
||||
[BoxGroup("Internal")] [Required] public Ring ring;
|
||||
|
||||
private Animator _animator;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_animator = GetComponent<Animator>();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
PuzzleEvent += (_, type) =>
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case PuzzleEventType.Restarted:
|
||||
ring.Solved = false;
|
||||
TurnOffRingLight();
|
||||
break;
|
||||
case PuzzleEventType.Solved:
|
||||
ring.Solved = true;
|
||||
ringLight.color = theme.solvedColor;
|
||||
TurnOnRingLight();
|
||||
break;
|
||||
case PuzzleEventType.WrongInput:
|
||||
ringLight.color = theme.puzzleColor;
|
||||
_animator.SetTrigger(LightFlash);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(type), type, null);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void TurnOnRingLight()
|
||||
{
|
||||
ringLight.active = true;
|
||||
}
|
||||
|
||||
public void TurnOffRingLight()
|
||||
{
|
||||
ringLight.active = false;
|
||||
}
|
||||
public override void SetModule(Module module) {}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user