public static TileData[,] Rotate(this TileData[,] matrix, int rotation)
    {
        rotation = rotation % 360;
        int width  = matrix.GetLength(0);
        int height = matrix.GetLength(1);

        switch (rotation)
        {
        case 0:
            break;

        case 90:
            matrix = Apply(matrix, height, false, width, true, (mat, y, x) => mat[x, y]);
            break;

        case 180:
            matrix = Apply(matrix, width, true, height, true, (mat, x, y) => mat[x, y]);
            break;

        case 270:
            matrix = Apply(matrix, height, true, width, false, (mat, y, x) => mat[x, y]);
            break;

        default:
            Debug.LogError("The rotation should be at a right angle");
            break;
        }
        return(matrix);
    }
Example #2
0
    //Generates a randomized 2D int Array, containing numbers 1-5.
    private static int[,] generateWeight(int seed, TileData[,] tiles)
    {
        int length = tiles.GetLength(0);
        int height = tiles.GetLength(1);

        System.Random random = new System.Random(seed);
        int[,] weights = new int[length, height];

        for (int i = 0; i < length; i++)
        {
            for (int j = 0; j < height; j++)
            {
                if (tiles[i, j] == null)
                {
                    weights[i, j] = random.Next(2, 8);
                }
                else if (tiles[i, j].isBorder)
                {
                    //Don't go through borders, if possible.
                    weights[i, j] = 5;
                }
                else
                {
                    //If this is part of a Room, then set its weight to one, to prefer already existing paths.
                    weights[i, j] = 1;
                }
            }
        }

        return(weights);
    }
    public void TestGetTileDataArray()
    {
        TileData[,] tileDataArray = _tileMapData.GetTileData();

        Assert.AreEqual(MAP_SQUARE_SIZE, tileDataArray.GetLength(0));
        Assert.AreEqual(MAP_SQUARE_SIZE, tileDataArray.GetLength(1));
    }
Example #4
0
 public void SetTile(int column, int row, TileData T)
 {
     if (column >= 0 && row >= 0 && column < data.GetLength(0) && row < data.GetLength(1))
     {
         data[column, row] = T;
     }
 }
Example #5
0
 public TileData getTileData(int i, int j)
 {
     if (i < 0 || j < 0 || i >= grid.GetLength(0) || j >= grid.GetLength(1))
     {
         return(null);
     }
     return(grid[i, j]);
 }
Example #6
0
 public void AddModifiedTiles(TileData[,] tile)
 {
     for (int x = 0; x < tile.GetLength(0); x++)
     {
         for (int y = 0; y < tile.GetLength(1); y++)
         {
             myModifiedTiles.Add(new Tuple <float, float, float>(tile[x, y].GetPosition().X, tile[x, y].GetPosition().Y, tile[x, y].GetPosition().Z), tile[x, y]);
         }
     }
 }
Example #7
0
 /// <summary>
 /// Determine if tile is in range
 /// </summary>
 /// <param name="p"></param>
 /// <returns></returns>
 public bool IsValidTile(int x, int y)
 {
     if (x >= 0 && x < tileMap.GetLength(0) &&
         y >= 0 && y < tileMap.GetLength(1) &&
         tileMap[x, y].GetTileType() != TileType.impassableTile)
     {
         return(true);
     }
     return(false);
 }
Example #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="data">x.length this width y.length this height</param>
        /// <param name="startWorldPos">left and down tile position</param>
        public Chunk(TileData[,] data, Vector2Int startWorldPos, World world)
        {
            Data = data;

            Bounds = new ChunkBound(startWorldPos, startWorldPos + new Vector2Int(
                                        data.GetLength(0) - 1,
                                        data.GetLength(1) - 1));

            for (var x = 0; x < data.GetLength(0); x++)
            {
                for (var y = 0; y < data.GetLength(1); y++)
                {
                    var tileData = data[x, y];
                    tileData.TargetBlock.Position = new Vector2Int(x, y) + startWorldPos;
                }
            }
        }
Example #9
0
        private void DrawTiles()
        {
            //Draw downtiles
            for (int x = newTileGrid.GetLength(0) - 1; x >= 0; x--)
            {
                for (int y = newTileGrid.GetLength(1) - 1; y >= 0; y--)
                {
                    if (newTileGrid[x, y] != null)
                    {
                        TileDrawer.DrawTileAt(spriteBatch, newTileGrid[x, y].type, new Point(x, y));
                    }
                }
            }

            //Drawuptiles
            for (int x = newTileGrid.GetLength(0) - 1; x >= 0; x--)
            {
                for (int y = newTileGrid.GetLength(1) - 1; y >= 0; y--)
                {
                    if (newTileGrid[x, y] != null)
                    {
                        TileDrawer.DrawTileRoofingAt(spriteBatch, newTileGrid[x, y].type, new Point(x, y));
                    }
                }
            }
        }
Example #10
0
 public Zone(Area area)
 {
     Random r = new Random();
     this.Grass = new TileData();
     this.Water = new TileData();
     Grass.Sprite = new Graphics.Sprite("grass");
     Water.Sprite = new Graphics.Sprite("water");
     this.area = area;
     this.World = area.World;
     tileMap = new TileData[(int)area.ZoneSize.X, (int)area.ZoneSize.Y];
     for (int y = 0; y < tileMap.GetLength(0); ++y)
     {
         for (int x = 0; x < tileMap.GetLength(1); ++x)
         {
             tileMap[y, x] = (x == 0) ? this.Grass : this.Water;
         }
     }
 }
    public static TileData[,] Mirror(this TileData[,] matrix, int axis)
    {
        int width  = matrix.GetLength(0);
        int height = matrix.GetLength(1);

        switch (axis)
        {
        case 0:
            matrix = Apply(matrix, width, true, height, false, (mat, x, y) => mat[x, y]);
            break;

        case 1:
            matrix = Apply(matrix, width, false, height, true, (mat, x, y) => mat[x, y]);
            break;

        default:
            Debug.LogError("The axis should be 0 or 1 : " + axis);
            break;
        }
        return(matrix);
    }
        private void GenerateViews()
        {
            TileData[,] dataArray = _file.Data.TileArray;
            int xLength = dataArray.GetLength(0);
            int yLength = dataArray.GetLength(1);

            #region Define Grid
            GridLength rowHeight = new GridLength(50);
            GridLength colWidth  = new GridLength(50);
            for (int y = 0; y < yLength; y++)
            {
                RowDefinition rowDef = new RowDefinition()
                {
                    Height = rowHeight
                };
                WorldGrid.RowDefinitions.Add(rowDef);
            }
            for (int x = 0; x < xLength; x++)
            {
                ColumnDefinition colDef = new ColumnDefinition()
                {
                    Width = colWidth
                };
                WorldGrid.ColumnDefinitions.Add(colDef);
            }
            #endregion

            for (int y = 0; y < yLength; y++)
            {
                for (int x = 0; x < xLength; x++)
                {
                    TileData         data        = dataArray[x, y];
                    WorldTileControl tileControl = new WorldTileControl(data);
                    Grid.SetColumn(tileControl, x);
                    Grid.SetRow(tileControl, y);
                    WorldGrid.Children.Add(tileControl);
                    tileControl.MouseLeftButtonDown += TileControl_MouseDown;
                }
            }
        }
        /// <summary>
        /// Reparent tile game objects into world space so that their transforms can be
        /// maintained when they are placed into their new chunks.
        /// </summary>
        /// <param name="map">New tile map.</param>
        private void ReparentTileGameObjectsIntoWorldSpace(TileData[,] map)
        {
            int mapRows    = map.GetLength(0);
            int mapColumns = map.GetLength(1);

            for (int row = 0; row < mapRows; ++row)
            {
                this.taskProgress += this.taskIncrement;
                InternalUtility.ProgressHandler("Rebuilding Tile System", "Clearing existing chunks.", this.taskProgress);

                for (int column = 0; column < mapColumns; ++column)
                {
                    var tile = map[row, column];
                    if (tile == null || tile.Empty || tile.gameObject == null)
                    {
                        continue;
                    }

                    tile.gameObject.transform.SetParent(null);
                }
            }
        }
Example #14
0
 public void CreateBoard(int width, int height)
 {
     Assert.IsTrue(oldTiles.GetLength(0) == oldBalls.GetLength(0) && oldTiles.GetLength(1) == oldBalls.GetLength(1));
     tiles = new TileData[width, height];
     balls = new BallData[width, height];
     for (int i = 0; i < width; i++)
     {
         for (int j = 0; j < height; j++)
         {
             if (oldBalls.GetLength(0) > i && oldBalls.GetLength(1) > j)
             {
                 tiles[i, j] = oldTiles[i, j];
                 balls[i, j] = oldBalls[i, j];
             }
             else
             {
                 tiles[i, j] = TileData.GetNormalTile();
                 balls[i, j] = BallData.GetEmptyBall();
             }
         }
     }
     UpdateModel();
 }
Example #15
0
    private static void defaultRoomGen(Area area, int seed, ref TileData[,] tiles, ref List <Room> rooms)
    {
        System.Random random = new System.Random(seed);

        //Determine number of Rooms to make.
        int numOfRooms = random.Next(5, 10);

        int currentRoom = 0;
        int failures    = 0;

        //While we still need more Rooms, and we've failed to make a room less than 5 times in a row.
        while (currentRoom < numOfRooms && failures < 6)
        {
            //Create random sized room.
            int xSize = random.Next(4, 8);
            int ySize = random.Next(4, 8);

            //Create random botLeft Point to place the Room.
            Point placement = new Point(random.Next(1, tiles.GetLength(0) - xSize - 1), random.Next(1, tiles.GetLength(1) - ySize - 1));

            Room newRoom = new Room(area, placement, new Point(placement.x + xSize, placement.y + ySize));

            bool roomFailed = false;
            //Test to ensure this Room doesn't overlap other rooms.
            foreach (Room r in rooms)
            {
                if (newRoom.intersects(r))
                {
                    roomFailed = true;
                    break;
                }
            }

            if (!roomFailed)
            {
                //Place the Room as Tiles in the Area.
                placeRoom(ref tiles, newRoom);

                rooms.Add(newRoom);

                //Reset the failure count, since this was a success!
                failures = 0;
                currentRoom++;
            }
            else
            {
                failures++;
            }
        }
    }
Example #16
0
 public override bool IsValid()
 {
     if (balls.GetLength(0) != tiles.GetLength(0) || balls.GetLength(1) != tiles.GetLength(1))
     {
         return(false);
     }
     else
     {
         return(CheckObjectives());
     }
 }
Example #17
0
    public TileData GetTileUnderPointer()
    {
        if (mycam == null)
        {
            mycam = Camera.main;
        }

        Vector3 pos = mycam.ScreenToWorldPoint(SmartInput.inputPos);
        int     x   = (int)pos.x;
        int     y   = (int)pos.y;

        if (x >= 0 && x < myTiles.GetLength(0) && y >= 0 && y < myTiles.GetLength(1))
        {
            return(myTiles[x, y]);
        }
        else
        {
            return(null);
        }
    }
Example #18
0
    // en faire une pour le terrain et une pour temperature / humidity ou whatever ?
    // pour pouvoir en afficher plusieurs d'un coup

    public static Texture2D GetTexture(TileData[,] tileDataMap, DrawMap drawMap, bool drawUnderwaterSteps, Biome[] biomes)
    {
        //TileData[,] tileDataMap = mapData.tileDataMap;

        int width  = tileDataMap.GetLength(0);
        int height = tileDataMap.GetLength(1);

        Color biomeBorderColor = Color.black;   // à mettre avec la suivante en public inspector terrain setting
        Color edgeColor        = Color.white;
        Color cityColor        = Color.magenta; // en fonction du thème couleur de la ville ?

        var texture = new Texture2D(width, height);

        Color[] pixels = new Color[width * height];

        for (int x = 0; x < width; x++)
        {
            for (int y = 0; y < height; y++)
            {
                // moyen de generaliser le drawing des edges et borders ici
                switch (drawMap)
                {
                case DrawMap.Height:
                    //Set color range, 0 = black, 1 = white
                    if (tileDataMap[x, y].isEdge)
                    {
                        pixels[x + y * width] = edgeColor;
                    }
                    else
                    {
                        pixels[x + y * width] = Color.Lerp(Color.black, Color.white, tileDataMap[x, y].terrainHeight);
                    }
                    break;

                case DrawMap.HeightType:
                    if (tileDataMap[x, y].isBiomeBorder)
                    {
                        pixels[x + y * width] = biomeBorderColor;
                    }
                    else if (tileDataMap[x, y].isEdge && drawUnderwaterSteps)
                    {
                        pixels[x + y * width] = edgeColor;
                    }
                    else
                    {
                        pixels[x + y * width] = tileDataMap[x, y].terrainType.color;
                    }
                    break;

                // sur les trois qui suivent c chiant de pas voir les heights faut refaire des f°
                case DrawMap.Humidity:
                    if (tileDataMap[x, y].isBiomeBorder)
                    {
                        pixels[x + y * width] = biomeBorderColor;
                    }
                    else if (tileDataMap[x, y].isEdge && drawUnderwaterSteps)
                    {
                        pixels[x + y * width] = edgeColor;
                    }
                    else
                    {
                        pixels[x + y * width] = tileDataMap[x, y].humidityType.color;
                    }
                    break;

                case DrawMap.Temperature:
                    if (tileDataMap[x, y].isBiomeBorder)
                    {
                        pixels[x + y * width] = biomeBorderColor;
                    }
                    else if (tileDataMap[x, y].isEdge && drawUnderwaterSteps)
                    {
                        pixels[x + y * width] = edgeColor;
                    }
                    else
                    {
                        pixels[x + y * width] = tileDataMap[x, y].temperatureType.color;
                    }
                    break;

                case DrawMap.Biome:
                    if (tileDataMap[x, y].isBiomeBorder)
                    {
                        pixels[x + y * width] = biomeBorderColor;
                    }
                    else if (tileDataMap[x, y].isEdge && drawUnderwaterSteps)
                    {
                        pixels[x + y * width] = edgeColor;
                    }
                    else
                    {
                        for (int i = 0; i < biomes.Length; i++)
                        {
                            if (biomes[i].biomeType == tileDataMap[x, y].biomeType)
                            {
                                pixels[x + y * width] = biomes[i].pixelColor;
                                break;
                            }
                        }
                        if (tileDataMap[x, y].terrainType.terrainTypeName == TerrainTypeName.DeepWater)
                        {
                            pixels[x + y * width] = tileDataMap[x, y].terrainType.color;
                        }
                        else if (tileDataMap[x, y].terrainType.terrainTypeName == TerrainTypeName.ShallowWater)
                        {
                            pixels[x + y * width] = tileDataMap[x, y].terrainType.color;
                        }
                    }
                    break;

                case DrawMap.City:
                    if (tileDataMap[x, y].isBiomeBorder)
                    {
                        pixels[x + y * width] = biomeBorderColor;
                    }
                    else if (tileDataMap[x, y].isEdge && drawUnderwaterSteps)
                    {
                        pixels[x + y * width] = edgeColor;
                    }
                    else if (tileDataMap[x, y].isCity)
                    {
                        pixels[x + y * width] = cityColor;
                    }
                    else
                    {
                        for (int i = 0; i < biomes.Length; i++)
                        {
                            if (biomes[i].biomeType == tileDataMap[x, y].biomeType)
                            {
                                pixels[x + y * width] = biomes[i].pixelColor;
                                break;
                            }
                        }
                        if (tileDataMap[x, y].terrainType.terrainTypeName == TerrainTypeName.DeepWater)
                        {
                            pixels[x + y * width] = tileDataMap[x, y].terrainType.color;
                        }
                        else if (tileDataMap[x, y].terrainType.terrainTypeName == TerrainTypeName.ShallowWater)
                        {
                            pixels[x + y * width] = tileDataMap[x, y].terrainType.color;
                        }
                    }
                    break;
                }
            }
        }

        texture.SetPixels(pixels);
        texture.wrapMode = TextureWrapMode.Clamp;
        texture.Apply();
        return(texture);
    }
Example #19
0
 public void LoadRegionsBasedOnPosition(Vector2 myPlayerVector)
 {
     float DisplayedRegionX = myDrawRegions.GetLength(0);
     float DisplayedRegionY = myDrawRegions.GetLength(1);
 }
Example #20
0
 private void CreateDetails()
 {
     for (int x = 0; x < tiles.GetLength(0); x++)
     {
         for (int y = 0; y < tiles.GetLength(1); y++)
         {
             Vector2Int         pos            = new Vector2Int(x, y);
             IList <Vector2Int> immediateTiles = new List <Vector2Int>(Utils.GetAdjCoordsArr(pos))
             {
                 pos
             };
             if (SurroundedBy(immediateTiles, IsSandTile))
             {
                 if (Utils.r.Next(100) < 10)
                 {
                     SetDetail(pos, Detail.Palm, false);
                     TileRegistry.GetInstance().SetPalmTile(pos);
                 }
                 else if (Utils.r.Next(100) < 1)
                 {
                     SetDetail(pos, Detail.DessertRock, false);
                     TileRegistry.GetInstance().SetRockBeachTile(pos);
                 }
             }
             else if (SurroundedBy(immediateTiles, IsGrassTile) || SurroundedBy(immediateTiles, IsCliffTile))
             {
                 if (Utils.r.Next(100) < 10)
                 {
                     SetDetail(pos, Detail.Tree, false);
                     TileRegistry.GetInstance().SetTreeTile(pos);
                 }
                 else if (Utils.r.Next(100) < 1)
                 {
                     SetDetail(pos, Detail.Rock, false);
                     TileRegistry.GetInstance().SetRockTile(pos);
                 }
             }
         }
     }
 }
Example #21
0
    //Creates GameObjects of the 2D array, and displays them. Or if they're already created, just display them.
    public void showArea()
    {
//		Debug.Log("HERE");
        if (!isCity)
        {
            //Don't make GameObjects, if this area is already created.
            if (!isCreated)
            {
                //Ensure that this area has been generated. If not, do the generation now.
                if (!isGenerated)
                {
                    generateArea();
                }

                //Determine the TileSet to be used.
                TileSet mySet;
                switch (group.biome)
                {
                //In the case of any of these Biomes, use the grassyPath Tile set, until we get new tile sets.
                case (Biome.C):
                case (Biome.HTML):
                case (Biome.PYTHON):
                    mySet = LoadResources.Instance.grassyPath.GetComponent <TileSet>();
                    break;

                default:
                    throw new System.MissingFieldException("Area does not have an Area Group!");
                }

                objects = new List <Tile>();
                portals = new List <Tile>();

                GameObject parent = new GameObject();
                parent.name = "Area Parent";

                //Create the GameObjects by iterating through the information.
                for (int i = 0; i < tiles.GetLength(0); i++)
                {
                    for (int j = 0; j < tiles.GetLength(1); j++)
                    {
                        //Do GameObject creation here.
                        if (tiles[i, j] != null)
                        {
                            if (tiles[i, j].isTile)
                            {
                                //Create Tile Object
                                Tile temp = (Tile)GameObject.Instantiate(mySet.tiles[0],
                                                                         new Vector3(i * 10, mySet.tiles[0].y, j * 10), Quaternion.identity);

                                temp.transform.parent = parent.transform;
                                temp.x = i;
                                temp.y = j;

                                objects.Add(temp);
                            }
                            else if (tiles[i, j].isBorder)
                            {
                                //Create Wall Object
                                Tile temp = (Tile)GameObject.Instantiate(mySet.tiles[1],
                                                                         new Vector3(i * 10, mySet.tiles[1].y, j * 10), Quaternion.identity);

                                temp.transform.parent = parent.transform;
                                temp.x = i;
                                temp.y = j;

                                objects.Add(temp);
                            }
                            else if (tiles[i, j].isPortal)
                            {
                                //Create Portal Object.
                                Tile temp = (Tile)GameObject.Instantiate(LoadResources.Instance.portal,
                                                                         new Vector3(i * 10, LoadResources.Instance.portal.y, j * 10), Quaternion.identity);

                                switch (tiles[i, j].portalDirection)
                                {
                                case (Direction.UP):
                                    break;

                                case (Direction.LEFT):
                                    temp.transform.eulerAngles = new Vector3(0, 270, 0);
                                    break;

                                case (Direction.DOWN):
                                    temp.transform.eulerAngles = new Vector3(0, 180, 0);
                                    break;

                                case (Direction.RIGHT):
                                    temp.transform.eulerAngles = new Vector3(0, 90, 0);
                                    break;
                                }

                                temp.gameObject.GetComponent <Portal>().dir = tiles[i, j].portalDirection;
                                temp.x = i;
                                temp.y = j;

                                objects.Add(temp);
                                portals.Add(temp);
                            }
                        }
                    }
                }

                isHidden = false;
            }
        }
        else //else this is a city, so instantiate THE CITY PREFAB! MUAHAHA!
        {
            portals = new List <Tile>();
            //TODO: Add the portals to the portal List here!
            GameObject temp = (GameObject)GameObject.Instantiate(LoadResources.Instance.city, new Vector3(0, 0, 0), Quaternion.identity);
            city = temp;
            GameObject portalParent = temp.transform.GetChild(0).gameObject;
            if (portalParent.name == "portals")
            {
                foreach (Tile p in portalParent.transform.GetComponentsInChildren <Tile>())
                {
                    portals.Add(p);
                }
            }

            isGenerated = true;
            isHidden    = false;
        }

        /*if (isHidden)
         * {*/

        //Go through each room in the area and spawn any objects in it
        System.Random random = new System.Random(areaSeed);

        foreach (Room r in rooms)
        {
            r.showRoom(random);
        }

        /*    isHidden = false;
         * }*/
    }
Example #22
0
    //Creates corridors from room to room,and returns the list of corridors. (Rooms tiles are not included in corridors).
    private static List <TileData> defaultConnect(int seed, ref TileData[,] tiles, ref List <Room> rooms)
    {
        //Generate the weight map for A*.
        int[,] weights = generateWeight(seed, tiles);

        List <TileData> corridors = new List <TileData>();

        //Connect first Room to all others.
        for (int i = 1; i < rooms.Count; i++)
        {
            //Get starting point. (middle of start Room)
            Point start = rooms[0].getTopRight();
            start = new Point(start.x - rooms[0].length / 2, start.y - rooms[0].height / 2);

            //Get ending point. (middle of other Room)
            Point end = rooms[i].getTopRight();
            end = new Point(end.x - rooms[i].length / 2, end.y - rooms[i].height / 2);

            //Plan:
            //Add starting point to Open List.
            //Sort Open list by F value, which is the distance from the end (found by heuristic) + currentCost.
            //While Open List is NOT empty
            //Get next Point to calculate, and put it on closed list.
            //foreach neighbor to this nextPoint
            //If neighbor point is the final point, make connections and break.
            //If neighbor point is not walkable, continue.
            //If neighbor point is NOT on the open List, calc ALL it's moveCost values F,G,H, and set the next Point
            //as it's cameFrom point.
            //If neighbor point is ON the open List (and maybe the closed),
            //if this REALcost (G, not heuristic) from this nextPoint is better than
            //the one it already has, replace its cameFrom with next point, and re-calc its F,G,H

            //OpenList sorted by F values.
            PriorityQueue <int, path> openList = new PriorityQueue <int, path>();

            pathMap map = new pathMap(tiles.GetLength(0), tiles.GetLength(1));

            path startPath = map.getPath(start);
            startPath.cameFrom = null;    //Starting point came From null. (this is a flag for later)
            startPath.openList = true;
            startPath.setValues(0, 0, 0); //Start point doesn't need values.

            openList.Enqueue(0, startPath);

            bool isFinished = false;

            while (!openList.IsEmpty && !isFinished)
            {
                path next = openList.DequeueValue();
                next.closedList = true;

                foreach (path neighbor in next.getNeighbors())
                {
                    if (neighbor.position.Equals(end))
                    {
                        //Do ending stuff!
                        isFinished = true;

                        neighbor.cameFrom = next;

                        //Start function to get the path, and put the path into corridors, and put the corridors on the tile map.
                        corridors.AddRange(getFinishedPath(neighbor, ref tiles));

                        break;
                    }

                    //If not walkable, then check for that here. (currently not possible)

                    if (!neighbor.openList)
                    {
                        //PUT on open List.
                        neighbor.openList = true;

                        neighbor.cameFrom = next;
                        neighbor.setValues(next.cost + weights[neighbor.position.x, neighbor.position.y], neighbor.position.tileDiff(end));

                        openList.Enqueue(neighbor.probableCost, neighbor);
                    }
                    else if (!neighbor.closedList)
                    {
                        //Compare its current values, and change em if need be.
                        int newCost = next.cost + weights[neighbor.position.x, neighbor.position.y];
                        if (newCost < neighbor.cost)
                        {
                            //May not actually work...
                            KeyValuePair <int, path> oldPair = new KeyValuePair <int, path>(neighbor.probableCost, neighbor);

                            openList.Remove(oldPair);
                            neighbor.setValues(newCost, neighbor.position.tileDiff(end));

                            openList.Enqueue(neighbor.probableCost, neighbor);
                        }
                    }
                }
            } //End of While Loop
        }     //End of For Loop

        return(corridors);
    }