43 lines
1.1 KiB
C#
43 lines
1.1 KiB
C#
using EscapeRoomEngine.Engine.Runtime;
|
|
using NaughtyAttributes;
|
|
using UnityEngine;
|
|
|
|
namespace EscapeRoomEngine.Desert.Runtime.Puzzle_A
|
|
{
|
|
public class SymbolButton : Button
|
|
{
|
|
private static readonly int FresnelColor = Shader.PropertyToID("_FresnelColor");
|
|
private static readonly int Color = Shader.PropertyToID("_Color");
|
|
|
|
public int symbolNumber;
|
|
public EngineTheme theme;
|
|
[BoxGroup("Internal")] [Required] public MeshRenderer holoRenderer;
|
|
|
|
private Material _material;
|
|
|
|
private void Awake()
|
|
{
|
|
_material = holoRenderer.material;
|
|
}
|
|
|
|
protected override void Start()
|
|
{
|
|
base.Start();
|
|
|
|
ButtonEvent += (_, _) =>
|
|
{
|
|
var color = theme.puzzleColor;
|
|
if (!Active)
|
|
{
|
|
color = theme.solvedColor;
|
|
} else if (Pressed)
|
|
{
|
|
color = theme.activeColor;
|
|
}
|
|
|
|
_material.SetColor(FresnelColor, color);
|
|
_material.SetColor(Color, color);
|
|
};
|
|
}
|
|
}
|
|
} |