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