private static DoorInstance TransformDoorInfo(IDoorInfo <Room> doorInfo, RoomInstance connectedRoomInstance) { var doorLine = doorInfo.DoorLine; switch (doorLine.GetDirection()) { case OrthogonalLine.Direction.Right: return(new DoorInstance(new Unity.Utils.OrthogonalLine(doorLine.From.ToUnityIntVector3(), doorLine.To.ToUnityIntVector3()), Vector2Int.up, connectedRoomInstance.Room, connectedRoomInstance)); case OrthogonalLine.Direction.Left: return(new DoorInstance(new Unity.Utils.OrthogonalLine(doorLine.To.ToUnityIntVector3(), doorLine.From.ToUnityIntVector3()), Vector2Int.down, connectedRoomInstance.Room, connectedRoomInstance)); case OrthogonalLine.Direction.Top: return(new DoorInstance(new Unity.Utils.OrthogonalLine(doorLine.From.ToUnityIntVector3(), doorLine.To.ToUnityIntVector3()), Vector2Int.left, connectedRoomInstance.Room, connectedRoomInstance)); case OrthogonalLine.Direction.Bottom: return(new DoorInstance(new Unity.Utils.OrthogonalLine(doorLine.To.ToUnityIntVector3(), doorLine.From.ToUnityIntVector3()), Vector2Int.right, connectedRoomInstance.Room, connectedRoomInstance)); default: throw new ArgumentOutOfRangeException(); } }
public DoorModel <TNode> GetDoorModel <TNode>(IDoorInfo <TNode> doorInfo) { return(new DoorModel <TNode>() { Node = doorInfo.Node, From = doorInfo.DoorLine.From, To = doorInfo.DoorLine.To, }); }
protected DoorInfo <int> TransformDoorInfo(IDoorInfo <int> oldDoorInfo) { var doorLine = oldDoorInfo.DoorLine; switch (doorLine.GetDirection()) { case OrthogonalLine.Direction.Right: return(new DoorInfo <int>(new Utils.OrthogonalLine(doorLine.From.ToUnityIntVector3(), doorLine.To.ToUnityIntVector3()), Vector2Int.up, oldDoorInfo.Node)); case OrthogonalLine.Direction.Left: return(new DoorInfo <int>(new Utils.OrthogonalLine(doorLine.To.ToUnityIntVector3(), doorLine.From.ToUnityIntVector3()), Vector2Int.down, oldDoorInfo.Node)); case OrthogonalLine.Direction.Top: return(new DoorInfo <int>(new Utils.OrthogonalLine(doorLine.From.ToUnityIntVector3(), doorLine.To.ToUnityIntVector3()), Vector2Int.left, oldDoorInfo.Node)); case OrthogonalLine.Direction.Bottom: return(new DoorInfo <int>(new Utils.OrthogonalLine(doorLine.To.ToUnityIntVector3(), doorLine.From.ToUnityIntVector3()), Vector2Int.right, oldDoorInfo.Node)); default: throw new ArgumentOutOfRangeException(); } }