63 lines
1.6 KiB
C#
63 lines
1.6 KiB
C#
using Station46.Modules.Dispenser.Scripts;
|
|
using Station46.Scripts;
|
|
using UnityEngine;
|
|
|
|
namespace Station46.Modules.Holes.Scripts
|
|
{
|
|
/// <summary>
|
|
/// A hole used in the <see cref="Holes"/> module.
|
|
/// </summary>
|
|
[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<Emission>();
|
|
}
|
|
|
|
protected override void Start()
|
|
{
|
|
base.Start();
|
|
|
|
Emission.active = true;
|
|
}
|
|
|
|
private void OnTriggerEnter(Collider other)
|
|
{
|
|
var orb = other.GetComponent<DispenserOrb>();
|
|
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<DispenserOrb>();
|
|
if (orb != null)
|
|
{
|
|
var color = EscapeRoomEngine.Engine.Runtime.Engine.Theme.puzzleColor;
|
|
|
|
if (Active)
|
|
{
|
|
Release();
|
|
Emission.color = color.hdr;
|
|
}
|
|
orb.Color = color.hdr;
|
|
}
|
|
}
|
|
}
|
|
} |