using Station46.Dispenser.Scripts; using Station46.Runtime; using UnityEngine; namespace Station46.Holes.Scripts { /// /// 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 = EscapeRoomEngine.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 = EscapeRoomEngine.Engine.Runtime.Engine.Theme.puzzleColor; if (Active) { Release(); Emission.color = color.hdr; } orb.Color = color.hdr; } } } }