comment pass

This commit is contained in:
2022-12-29 16:16:49 +01:00
parent 643e03192a
commit ff01a700bd
75 changed files with 634 additions and 65 deletions

View File

@@ -3,10 +3,15 @@ using NaughtyAttributes;
namespace EscapeRoomEngine.Desert.Runtime.Puzzle_A
{
/// <summary>
/// The main component for the symbol ball module.
/// </summary>
public class Ball : ModuleState
{
[BoxGroup("Internal")] [Required] public Emission statusLight;
[BoxGroup("Internal")] [Required] public Ring ring;
[BoxGroup("Internal")] [Required]
public Emission statusLight;
[BoxGroup("Internal")] [Required]
public Ring ring;
public bool StatusLight
{

View File

@@ -6,12 +6,20 @@ using UnityEngine;
namespace EscapeRoomEngine.Desert.Runtime.Puzzle_A
{
/// <summary>
/// The rotating ring in the symbol ball module.
/// </summary>
public class Ring : MonoBehaviour
{
[Tooltip("Whether the ring is rotating.")]
public bool rotating = true;
[Tooltip("The current angle of the rotation.")]
public float rotationAngle;
[MinMaxSlider(-180, 180)] public Vector2 activeRange;
[BoxGroup("Internal")] [Required] public Crystal crystal;
[Tooltip("The range in degrees from the front of the module where a symbol should be lit up.")]
[MinMaxSlider(-180, 180)]
public Vector2 activeRange;
[BoxGroup("Internal")] [Required]
public Crystal crystal;
[BoxGroup("Internal")]
[ValidateInput("SymbolCount", "Must have same amount of symbols and slots.")]
public List<Symbol> symbols;

View File

@@ -1,4 +1,5 @@
using System;
using NaughtyAttributes;
using UnityEngine;
using Logger = EscapeRoomEngine.Engine.Runtime.Utilities.Logger;
using LogType = EscapeRoomEngine.Engine.Runtime.Utilities.LogType;
@@ -27,13 +28,23 @@ namespace EscapeRoomEngine.Desert.Runtime.Puzzle_A
public delegate void SymbolEventHandler(SymbolEventType e);
/// <summary>
/// The main component for the symbols on the symbol ring module.
/// </summary>
[RequireComponent(typeof(Emission))]
public class Symbol : MonoBehaviour
{
public int symbolNumber, symbolPosition;
[Tooltip("The number of the symbol in the puzzle solution.")]
public int symbolNumber;
[BoxGroup("Internal")]
public int symbolPosition;
[BoxGroup("Internal")]
public float anglePosition;
public event SymbolEventHandler SymbolEvent;
/// <summary>
/// Whether the symbol is lit up. This is controlled by the <see cref="Ring"/>.
/// </summary>
public bool Active
{
set

View File

@@ -1,7 +1,13 @@
namespace EscapeRoomEngine.Desert.Runtime.Puzzle_A
using UnityEngine;
namespace EscapeRoomEngine.Desert.Runtime.Puzzle_A
{
/// <summary>
/// A <see cref="HoloButton"/> that includes the number of its assigned symbol.
/// </summary>
public class SymbolButton : HoloButton
{
[Tooltip("The number of the symbol assigned to this button.")]
public int symbolNumber;
}
}

View File

@@ -10,12 +10,16 @@ using LogType = EscapeRoomEngine.Engine.Runtime.Utilities.LogType;
namespace EscapeRoomEngine.Desert.Runtime.Puzzle_A
{
/// <summary>
/// The main component for the terminal module.
/// </summary>
[RequireComponent(typeof(Animator))]
public class Terminal : CyclicStepPuzzle
{
private static readonly int LightFlash = Animator.StringToHash("Light Flash");
[BoxGroup("Internal")] [Required] public Emission terminalLight;
[BoxGroup("Internal")] [Required]
public Emission terminalLight;
[BoxGroup("Internal")]
[ValidateInput("SymbolCount", "Must have same amount of symbols and slots.")]
public List<SymbolButton> symbols;
@@ -82,6 +86,7 @@ namespace EscapeRoomEngine.Desert.Runtime.Puzzle_A
{
base.SetModule(module);
// The terminal requires a related symbol ball module
var firstRelatedModule = Module.relatedModules[0];
if (firstRelatedModule.State is Ball ball)
{
@@ -95,15 +100,15 @@ namespace EscapeRoomEngine.Desert.Runtime.Puzzle_A
TurnOnLights();
}
// required in animation
[UsedImplicitly] internal void TurnOnLights()
[UsedImplicitly] // required in animation
internal void TurnOnLights()
{
terminalLight.active = true;
_ball.StatusLight = true;
}
// required in animation
[UsedImplicitly] internal void TurnOffLights()
[UsedImplicitly] // required in animation
internal void TurnOffLights()
{
terminalLight.active = false;
_ball.StatusLight = false;
@@ -131,12 +136,19 @@ namespace EscapeRoomEngine.Desert.Runtime.Puzzle_A
#region Debug Buttons
[Button(enabledMode: EButtonEnableMode.Playmode)] public void PressSymbol0() => PressedSymbol(0);
[Button(enabledMode: EButtonEnableMode.Playmode)] public void PressSymbol1() => PressedSymbol(1);
[Button(enabledMode: EButtonEnableMode.Playmode)] public void PressSymbol2() => PressedSymbol(2);
[UsedImplicitly]
[Button(enabledMode: EButtonEnableMode.Playmode)]
public void PressSymbol0() => PressedSymbol(0);
[UsedImplicitly]
[Button(enabledMode: EButtonEnableMode.Playmode)]
public void PressSymbol1() => PressedSymbol(1);
[UsedImplicitly]
[Button(enabledMode: EButtonEnableMode.Playmode)]
public void PressSymbol2() => PressedSymbol(2);
#endregion
[UsedImplicitly] private bool SymbolCount(List<SymbolButton> list) => list.Count == symbolSlots.Count;
[UsedImplicitly] // used for field validation
private bool SymbolCount(List<SymbolButton> list) => list.Count == symbolSlots.Count;
}
}