add Puzzle A variants
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using EscapeRoomEngine.Engine.Runtime.Utilities;
|
||||
using JetBrains.Annotations;
|
||||
using NaughtyAttributes;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -9,8 +11,28 @@ namespace EscapeRoomEngine.Desert.Runtime.Puzzle_A
|
||||
public bool rotating = true;
|
||||
public float rotationAngle;
|
||||
[MinMaxSlider(-180, 180)] public Vector2 activeRange;
|
||||
[Required] public Crystal crystal;
|
||||
[BoxGroup("Internal")] [Required] public Crystal crystal;
|
||||
[BoxGroup("Internal")]
|
||||
[ValidateInput("SymbolCount", "Must have same amount of symbols and slots.")]
|
||||
public List<Symbol> symbols;
|
||||
[BoxGroup("Internal")]
|
||||
public List<Transform> symbolSlots;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
var angleDistance = 360f / symbols.Count;
|
||||
List<Symbol> symbolInstances = new(symbols.Count);
|
||||
|
||||
for (var i = 0; i < symbols.Count; i++)
|
||||
{
|
||||
var symbol = Instantiate(symbols.RandomElement(), symbolSlots[i], false);
|
||||
symbol.symbolPosition = i;
|
||||
symbol.anglePosition = i * angleDistance;
|
||||
symbolInstances.Add(symbol);
|
||||
}
|
||||
|
||||
symbols = symbolInstances;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
@@ -29,5 +51,7 @@ namespace EscapeRoomEngine.Desert.Runtime.Puzzle_A
|
||||
crystal.Active = activeSymbol;
|
||||
}
|
||||
}
|
||||
|
||||
[UsedImplicitly] private bool SymbolCount(List<Symbol> list) => list.Count == symbolSlots.Count;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user