desert portal

This commit is contained in:
2022-11-27 12:12:02 +01:00
parent bc61d04541
commit 15f3857302
65 changed files with 3412 additions and 1127 deletions

View File

@@ -1,4 +1,5 @@
using EscapeRoomEngine.Engine.Runtime.Modules;
using EscapeRoomEngine.Engine.Runtime.Utilities;
using Logger = EscapeRoomEngine.Engine.Runtime.Utilities.Logger;
using LogType = EscapeRoomEngine.Engine.Runtime.Utilities.LogType;
@@ -11,17 +12,49 @@ namespace EscapeRoomEngine.Engine.Runtime
internal Passage(DoorModule from)
{
if (!from.IsExit && !from.description.Equals(Engine.DefaultEngine.theme.spawnDoor))
{
throw new WrongTypeException(DoorType.Exit, DoorType.Entrance);
}
fromOut = from;
}
internal void ConnectTo(DoorModule door)
internal void PlaceEntrance(DoorModule door)
{
if (!door.IsEntrance)
{
throw new WrongTypeException(DoorType.Entrance, DoorType.Exit);
}
toIn = door;
// to make sure the origin of the player doesn't move, the two doors must be placed in the same location in the same orientation
toIn.PlaceRoomRelative(fromOut.RrPosition, fromOut.Orientation);
Logger.Log($"Connected passage from {fromOut} to {toIn} at {toIn.RrPosition} (RR)", LogType.PassageConnection);
Logger.Log($"Placed entrance {toIn} at {toIn.RrPosition} (RR)", LogType.ModulePlacement);
}
internal void ConnectDoors()
{
toIn.Passage = this;
fromOut.Passage = this;
Logger.Log($"Connected passage from {fromOut} to {toIn}", LogType.PassageConnection);
}
internal DoorModule Other(DoorModule of)
{
if (of.Equals(fromOut))
{
return toIn;
}
if(of.Equals(toIn))
{
return fromOut;
}
throw new EngineException($"{of} is not connected to this passage");
}
}
}