holes
This commit is contained in:
57
Assets/Desert/Runtime/Puzzle C/Hole.cs
Normal file
57
Assets/Desert/Runtime/Puzzle C/Hole.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user