This commit is contained in:
2022-11-30 22:32:10 +01:00
parent 2b3daeadc2
commit ae3c6a50f5
35 changed files with 4502 additions and 7 deletions

View File

@@ -0,0 +1,57 @@
using EscapeRoomEngine.Engine.Runtime.Utilities;
using UnityEngine;
namespace EscapeRoomEngine.Desert.Runtime.Puzzle_C
{
[RequireComponent(typeof(Emission), typeof(Collider))]
public class Hole : Button
{
[Min(0)]
public int number;
public Emission Emission { get; private set; }
private DynamicColor _puzzleColor, _activeColor;
private void Awake()
{
Emission = GetComponent<Emission>();
_puzzleColor = Engine.Runtime.Engine.DefaultEngine.theme.puzzleColor;
_activeColor = Engine.Runtime.Engine.DefaultEngine.theme.activeColor;
}
protected override void Start()
{
base.Start();
Emission.active = true;
}
private void OnTriggerEnter(Collider other)
{
var orb = other.GetComponent<HoleOrb>();
if (orb != null)
{
if (Active)
{
Press();
Emission.color = _activeColor.hdr;
}
}
}
private void OnTriggerExit(Collider other)
{
var orb = other.GetComponent<HoleOrb>();
if (orb != null)
{
if (Active)
{
Release();
Emission.color = _puzzleColor.hdr;
}
}
}
}
}