don't cache theme colours

This commit is contained in:
2022-12-02 11:03:00 +01:00
parent 88f1b19990
commit 824e043862
10 changed files with 71 additions and 75 deletions

View File

@@ -1,5 +1,4 @@
using EscapeRoomEngine.Engine.Runtime.Modules;
using EscapeRoomEngine.Engine.Runtime.Utilities;
using NaughtyAttributes;
namespace EscapeRoomEngine.Desert.Runtime.Puzzle_A
@@ -9,14 +8,6 @@ namespace EscapeRoomEngine.Desert.Runtime.Puzzle_A
[BoxGroup("Internal")] [Required] public Emission statusLight;
[BoxGroup("Internal")] [Required] public Ring ring;
private DynamicColor _puzzleColor, _solvedColor;
private void Awake()
{
_puzzleColor = Engine.Runtime.Engine.DefaultEngine.theme.puzzleColor;
_solvedColor = Engine.Runtime.Engine.DefaultEngine.theme.solvedColor;
}
public bool StatusLight
{
set => statusLight.active = value;
@@ -24,14 +15,13 @@ namespace EscapeRoomEngine.Desert.Runtime.Puzzle_A
public bool Active
{
get => _active;
set
{
_active = value;
statusLight.color = _active ? _puzzleColor.hdr : _solvedColor.hdr;
ring.rotating = _active;
if (!_active)
statusLight.color = value ?
Engine.Runtime.Engine.DefaultEngine.theme.puzzleColor.hdr
: Engine.Runtime.Engine.DefaultEngine.theme.solvedColor.hdr;
ring.rotating = value;
if (!value)
{
ring.crystal.Active = false;
ring.symbols.ForEach(symbol => symbol.Active = false);
@@ -39,8 +29,6 @@ namespace EscapeRoomEngine.Desert.Runtime.Puzzle_A
}
}
private bool _active;
public override void SetModule(Module module) {}
}
}