public ProtoRoom(int id, PointInt coordinatesXY, int elevation = 3)
 {
     ID = id;
     ProtoRegion = null;
     ProtoSubregion = null;
     CoordinatesXY = coordinatesXY;
     // DirectionalRoomConnections = new List<string>();
     DirectionalRoomConnections = new Dictionary<string, Tuple<int, int, int>>();
     ProtoRoomConnections = new List<RoomConnection>();
     Available = true;
     Elevation = elevation; // default (3) is grass/green
 }
 private PointInt GetNeighborCoordinates(PointInt sourceCoordinates, string strDirection)
 {
     switch (strDirection)
     {
         case "nw": return new PointInt(sourceCoordinates.X - 1, sourceCoordinates.Y - 1);
         case "n": return new PointInt(sourceCoordinates.X, sourceCoordinates.Y - 1);
         case "ne": return new PointInt(sourceCoordinates.X + 1, sourceCoordinates.Y - 1);
         case "w": return new PointInt(sourceCoordinates.X - 1, sourceCoordinates.Y);
         case "e": return new PointInt(sourceCoordinates.X + 1, sourceCoordinates.Y);
         case "sw": return new PointInt(sourceCoordinates.X - 1, sourceCoordinates.Y + 1);
         case "s": return new PointInt(sourceCoordinates.X, sourceCoordinates.Y + 1);
         case "se": return new PointInt(sourceCoordinates.X + 1, sourceCoordinates.Y + 1);
         default: return null;
     }
 }
 public void CenterOnPoint(PointInt p)
 {
     CenterOnPoint(p.X, p.Y);
 }
        private ProtoRoom AddRoomConnection(ProtoRoom currentRoom, string strDirection, ProtoRoom[,] masterRoomList, bool bForce = false)
        {
            Tuple<int, int, int> connectionWorldCoordinates;
            if (currentRoom.DirectionalRoomConnections.TryGetValue(strDirection, out connectionWorldCoordinates)) { return currentRoom; }

            string strOppositeDirection = string.Empty;
            PointInt connectingRoomCoordinates = null;
            switch (strDirection)
            {
                case "nw":
                    strOppositeDirection = "se";
                    connectingRoomCoordinates = new PointInt(currentRoom.CoordinatesXY.X - 1, currentRoom.CoordinatesXY.Y - 1);
                    break;
                case "n":
                    strOppositeDirection = "s";
                    connectingRoomCoordinates = new PointInt(currentRoom.CoordinatesXY.X, currentRoom.CoordinatesXY.Y - 1);
                    break;
                case "ne":
                    strOppositeDirection = "sw";
                    connectingRoomCoordinates = new PointInt(currentRoom.CoordinatesXY.X + 1, currentRoom.CoordinatesXY.Y - 1);
                    break;
                case "w":
                    strOppositeDirection = "e";
                    connectingRoomCoordinates = new PointInt(currentRoom.CoordinatesXY.X - 1, currentRoom.CoordinatesXY.Y);
                    break;
                case "e":
                    strOppositeDirection = "w";
                    connectingRoomCoordinates = new PointInt(currentRoom.CoordinatesXY.X + 1, currentRoom.CoordinatesXY.Y);
                    break;
                case "sw":
                    strOppositeDirection = "ne";
                    connectingRoomCoordinates = new PointInt(currentRoom.CoordinatesXY.X - 1, currentRoom.CoordinatesXY.Y + 1);
                    break;
                case "s":
                    strOppositeDirection = "n";
                    connectingRoomCoordinates = new PointInt(currentRoom.CoordinatesXY.X, currentRoom.CoordinatesXY.Y + 1);
                    break;
                case "se":
                    strOppositeDirection = "nw";
                    connectingRoomCoordinates = new PointInt(currentRoom.CoordinatesXY.X + 1, currentRoom.CoordinatesXY.Y + 1);
                    break;
                default:
                    throw new Exception();
            }

            if (connectingRoomCoordinates.X < 0) { return currentRoom; }
            if (connectingRoomCoordinates.X > Width - 1) { return currentRoom; }
            if (connectingRoomCoordinates.Y < 0) { return currentRoom; }
            if (connectingRoomCoordinates.Y > Height - 1) { return currentRoom; }

            ProtoRoom connectingRoom = masterRoomList[connectingRoomCoordinates.X, connectingRoomCoordinates.Y];
            if (connectingRoom.Elevation == 0 || connectingRoom.Elevation == 30) { return currentRoom; }
            if (connectingRoom.HasMaximumConnections && !bForce) { return currentRoom; }

            Debug.TotalConnectionCount++;

            currentRoom.DirectionalRoomConnections.Add(strDirection, connectingRoom.WorldCoordinatesAsTuple);
            connectingRoom.DirectionalRoomConnections.Add(strOppositeDirection, currentRoom.WorldCoordinatesAsTuple);
            return connectingRoom;
        }