using EscapeRoomEngine.Station46.Runtime.Dispenser;
using UnityEngine;
namespace EscapeRoomEngine.Station46.Runtime.Puzzle_C
{
///
/// A hole used in the module.
///
[RequireComponent(typeof(Emission), typeof(Collider))]
public class Hole : Button
{
[Tooltip("The number of this hole, starting from the bottom left.")]
[Min(0)]
public int number;
public Emission Emission { get; private set; }
private void Awake()
{
Emission = GetComponent();
}
protected override void Start()
{
base.Start();
Emission.active = true;
}
private void OnTriggerEnter(Collider other)
{
var orb = other.GetComponent();
if (orb != null)
{
if (Active)
{
var color = Engine.Runtime.Engine.Theme.activeColor;
orb.Color = color.hdr;
Emission.color = color.hdr;
Press();
}
}
}
private void OnTriggerExit(Collider other)
{
var orb = other.GetComponent();
if (orb != null)
{
var color = Engine.Runtime.Engine.Theme.puzzleColor;
if (Active)
{
Release();
Emission.color = color.hdr;
}
orb.Color = color.hdr;
}
}
}
}