puzzle module framework, puzzle a ball module

This commit is contained in:
2022-11-18 02:10:05 +01:00
parent bd0934636f
commit 99e0452379
90 changed files with 4799 additions and 51 deletions

View File

@@ -13,8 +13,20 @@ namespace Escape_Room_Engine.Engine.Scripts.Modules
{
public bool IsEntrance => IsType((ModuleType)DoorType.Entrance);
public bool IsExit => IsType((ModuleType)DoorType.Exit);
internal new DoorState State { get; private set; }
internal DoorState DoorState
{
get
{
if (State is DoorState doorState)
{
return doorState;
}
throw new Exception("DoorModule must contain a DoorState");
}
}
internal DoorModule(Space space, DoorModuleDescription description) : base(space, description)
{
srDimensions.Size = Vector2Int.one; // door always has size 1x1
@@ -27,12 +39,6 @@ namespace Escape_Room_Engine.Engine.Scripts.Modules
space.room.AddDoor(this);
}
protected override void AddStateComponent()
{
State = moduleObject.AddComponent<DoorState>();
State.SetModule(this);
}
public override string ToString()
{
return $"{(IsEntrance ? "Entrance" : IsExit ? "Exit" : "Unknown")} door";