refactor modules
This commit is contained in:
37
Assets/Station46/Modules/Portal/Scripts/Station46Portal.cs
Normal file
37
Assets/Station46/Modules/Portal/Scripts/Station46Portal.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using EscapeRoomEngine.Engine.Runtime.Modules.State;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Station46.Runtime.Portal
|
||||
{
|
||||
/// <summary>
|
||||
/// The Station 46 theme includes its own version of a portal that changes colour when it is unlocked.
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(Emission))]
|
||||
public class Station46Portal : EscapeRoomEngine.Portal.Runtime.Portal
|
||||
{
|
||||
private Emission _emission;
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
|
||||
_emission = GetComponent<Emission>();
|
||||
|
||||
DoorEvent += (_, type) =>
|
||||
{
|
||||
// ReSharper disable once SwitchStatementMissingSomeEnumCasesNoDefault ConvertSwitchStatementToSwitchExpression
|
||||
switch (type)
|
||||
{
|
||||
case DoorEventType.Unlocked:
|
||||
_emission.color = EscapeRoomEngine.Engine.Runtime.Engine.Theme.solvedColor.hdr;
|
||||
break;
|
||||
case DoorEventType.Locked:
|
||||
_emission.color = EscapeRoomEngine.Engine.Runtime.Engine.Theme.puzzleColor.hdr;
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
_emission.active = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 20837d5efd544d3eb07657f581cb76d2
|
||||
timeCreated: 1670792901
|
||||
Reference in New Issue
Block a user