desert portal
This commit is contained in:
@@ -15,7 +15,31 @@ namespace EscapeRoomEngine.Engine.Runtime.Modules
|
||||
public bool IsEntrance => IsType((ModuleType)DoorType.Entrance);
|
||||
public bool IsExit => IsType((ModuleType)DoorType.Exit);
|
||||
|
||||
internal DoorState DoorState => DoorState.FromState(State);
|
||||
public DoorState DoorState => DoorState.FromState(State);
|
||||
public DoorState ConnectedDoorState => Passage.Other(this).DoorState;
|
||||
|
||||
/// <summary>
|
||||
/// Once this property is set, the door is considered to be connected. This property must only be set once.
|
||||
/// </summary>
|
||||
internal Passage Passage
|
||||
{
|
||||
get => _passage;
|
||||
set
|
||||
{
|
||||
if (_passage != null)
|
||||
{
|
||||
throw new EngineException($"{this} is already connected");
|
||||
}
|
||||
|
||||
_passage = value;
|
||||
if (State != null)
|
||||
{
|
||||
DoorState.Connect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Passage _passage;
|
||||
|
||||
internal DoorModule(Space space, DoorModuleDescription description) : base(space, description) {}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace EscapeRoomEngine.Engine.Runtime.Modules
|
||||
{
|
||||
public enum DoorEventType
|
||||
{
|
||||
Locked, Unlocked
|
||||
Locked, Unlocked, Connected
|
||||
}
|
||||
|
||||
public delegate void DoorEventHandler(DoorModule source, DoorEventType e);
|
||||
@@ -14,7 +14,7 @@ namespace EscapeRoomEngine.Engine.Runtime.Modules
|
||||
{
|
||||
public event DoorEventHandler DoorEvent;
|
||||
|
||||
private DoorModule Module { get; set; }
|
||||
protected DoorModule Module { get; set; }
|
||||
public bool Unlocked
|
||||
{
|
||||
get => _unlocked;
|
||||
@@ -43,17 +43,17 @@ namespace EscapeRoomEngine.Engine.Runtime.Modules
|
||||
Module = DoorModule.FromModule(module);
|
||||
}
|
||||
|
||||
[Button(enabledMode: EButtonEnableMode.Playmode)]
|
||||
internal void Unlock()
|
||||
{
|
||||
Unlocked = true;
|
||||
}
|
||||
public void Connect() => OnDoorEvent(DoorEventType.Connected);
|
||||
|
||||
#region Debug Buttons
|
||||
|
||||
[Button(enabledMode: EButtonEnableMode.Playmode)]
|
||||
internal void Lock()
|
||||
{
|
||||
Unlocked = false;
|
||||
}
|
||||
internal void Unlock() => Unlocked = true;
|
||||
|
||||
[Button(enabledMode: EButtonEnableMode.Playmode)]
|
||||
internal void Lock() => Unlocked = false;
|
||||
|
||||
#endregion
|
||||
|
||||
public static DoorState FromState(ModuleState state)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user