correctly colour SymbolButton by button state, independently of event order
This commit is contained in:
@@ -35,7 +35,7 @@ namespace EscapeRoomEngine.Desert.Runtime
|
|||||||
public event ButtonEventHandler ButtonEvent;
|
public event ButtonEventHandler ButtonEvent;
|
||||||
|
|
||||||
[ShowNativeProperty]
|
[ShowNativeProperty]
|
||||||
private bool Active
|
protected bool Active
|
||||||
{
|
{
|
||||||
get => _active;
|
get => _active;
|
||||||
set
|
set
|
||||||
@@ -51,7 +51,7 @@ namespace EscapeRoomEngine.Desert.Runtime
|
|||||||
}
|
}
|
||||||
|
|
||||||
[ShowNativeProperty]
|
[ShowNativeProperty]
|
||||||
private bool Pressed
|
protected bool Pressed
|
||||||
{
|
{
|
||||||
get => _pressed;
|
get => _pressed;
|
||||||
set
|
set
|
||||||
|
|||||||
@@ -24,14 +24,16 @@ namespace EscapeRoomEngine.Desert.Runtime.Puzzle_A
|
|||||||
{
|
{
|
||||||
base.Start();
|
base.Start();
|
||||||
|
|
||||||
ButtonEvent += (_, type) =>
|
ButtonEvent += (_, _) =>
|
||||||
{
|
{
|
||||||
var color = type switch
|
var color = theme.puzzleColor;
|
||||||
|
if (!Active)
|
||||||
{
|
{
|
||||||
ButtonEventType.Pressed => theme.activeColor,
|
color = theme.solvedColor;
|
||||||
ButtonEventType.Deactivated => theme.solvedColor,
|
} else if (Pressed)
|
||||||
_ => theme.puzzleColor
|
{
|
||||||
};
|
color = theme.activeColor;
|
||||||
|
}
|
||||||
|
|
||||||
_material.SetColor(FresnelColor, color);
|
_material.SetColor(FresnelColor, color);
|
||||||
_material.SetColor(Color, color);
|
_material.SetColor(Color, color);
|
||||||
|
|||||||
Reference in New Issue
Block a user