small fixes
This commit is contained in:
48
Assets/Station46/Runtime/Crystal.cs
Normal file
48
Assets/Station46/Runtime/Crystal.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using EscapeRoomEngine.Engine.Runtime.Utilities;
|
||||
using NaughtyAttributes;
|
||||
using UnityEngine;
|
||||
|
||||
namespace EscapeRoomEngine.Desert.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// A rotating crystal that can change colour.
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(Emission))]
|
||||
public class Crystal : MonoBehaviour
|
||||
{
|
||||
[Required]
|
||||
[BoxGroup("Internal")]
|
||||
public Light crystalLight;
|
||||
|
||||
/// <summary>
|
||||
/// Turns the crystal light on or off.
|
||||
/// </summary>
|
||||
public bool Active
|
||||
{
|
||||
set
|
||||
{
|
||||
_emission.active = value;
|
||||
crystalLight.enabled = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The crystal light and emission colours.
|
||||
/// </summary>
|
||||
public DynamicColor Color
|
||||
{
|
||||
set
|
||||
{
|
||||
_emission.color = value.hdr;
|
||||
crystalLight.color = value.ldr;
|
||||
}
|
||||
}
|
||||
|
||||
private Emission _emission;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_emission = GetComponent<Emission>();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user