rework dimensions and orientation into Placement, optimise requirements to work on previous candidates, use vec3 for positions
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using EscapeRoomEngine.Engine.Runtime.Modules;
|
||||
using UnityEngine;
|
||||
using Logger = EscapeRoomEngine.Engine.Runtime.Utilities.Logger;
|
||||
using LogType = EscapeRoomEngine.Engine.Runtime.Utilities.LogType;
|
||||
|
||||
@@ -7,31 +6,12 @@ namespace EscapeRoomEngine.Engine.Runtime
|
||||
{
|
||||
public class Passage
|
||||
{
|
||||
internal DoorModule fromOut, toIn;
|
||||
/// <summary>
|
||||
/// The room relative (<i>RR</i>) position of this passage.
|
||||
/// </summary>
|
||||
internal Vector2Int rrPosition;
|
||||
internal readonly DoorModule fromOut;
|
||||
internal DoorModule toIn;
|
||||
|
||||
internal Passage(DoorModule from, bool spawnPassage = false)
|
||||
internal Passage(DoorModule from)
|
||||
{
|
||||
if (spawnPassage)
|
||||
{
|
||||
fromOut = from;
|
||||
rrPosition = Vector2Int.zero;
|
||||
}
|
||||
else
|
||||
{
|
||||
ConnectFrom(from);
|
||||
}
|
||||
}
|
||||
|
||||
internal void ConnectFrom(DoorModule door)
|
||||
{
|
||||
fromOut = door;
|
||||
rrPosition = fromOut.RrPosition;
|
||||
|
||||
Logger.Log($"Connected passage from {door} at {rrPosition} (RR)", LogType.PassageConnection);
|
||||
fromOut = from;
|
||||
}
|
||||
|
||||
internal void ConnectTo(DoorModule door)
|
||||
@@ -39,10 +19,9 @@ namespace EscapeRoomEngine.Engine.Runtime
|
||||
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(rrPosition);
|
||||
toIn.orientation = fromOut.orientation;
|
||||
toIn.PlaceRoomRelative(fromOut.RrPosition, fromOut.Orientation);
|
||||
|
||||
Logger.Log($"Connected passage to {door} at {rrPosition} (RR)", LogType.PassageConnection);
|
||||
Logger.Log($"Connected passage from {fromOut} to {toIn} at {toIn.RrPosition} (RR)", LogType.PassageConnection);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user