public void AddItem(Item item, int row, int column)
        {
            if (item == null)
            {
                Debug.LogWarning("Item (" + "undefined" + ") can't be placed in this inventory (" + _title + ")");
                return;
            }             // Debug

            if (!GridExt.IsInRange <Item>(_stock, new Vector2(row, column)))
            {
                Debug.LogWarning("Grid position (" + row + "," + column + ") in Inventory [" + _title + "] is out of range");
                return;
            }             // Debug

            if (_containingItemsByTitle.ContainsValue(item.Title))
            {
                _stock[row, column] = item;

                if (OnItemAdded != null)
                {
                    OnItemAdded(this, item, row, column);
                }
            }             // Adding item to row and column
            else
            {
                Debug.LogWarning("Item (" + item.Title + ") can't be placed in this inventory (" + _title + ")");
            }             // Debug
        }
        public Item GetItem(int row, int column)
        {
            if (!GridExt.IsInRange <Item>(_stock, new Vector2(row, column)))
            {
                Debug.LogWarning("Grid position (" + row + "," + column + ") in Inventory [" + _title + "] is out of range");
            }             // Debug

            return(GridExt.IsInRange <Item>(_stock, new Vector2(row, column)) ? _stock[row, column] : null);
        }
        protected TileTypes[,] Connectivity(TileTypes[,] grid, int connectivitySize)
        {
            TileTypes[,] tempGrid = new TileTypes[grid.GetLength(0), grid.GetLength(1)];

            // Clone grid
            for (int i = 0; i < grid.GetLength(0); i++)
            {
                for (int j = 0; j < grid.GetLength(1); j++)
                {
                    tempGrid[i, j] = grid[i, j];
                }
            }

            // Loop trough every tile
            for (int tileX = 0; tileX < _width; tileX++)
            {
                for (int tileY = 0; tileY < _height; tileY++)
                {
                    if (grid[tileX, tileY] == TileTypes.Wall)
                    {
                        continue;
                    }

                    GridNeighbours <TileTypes> gridNeighbours = new GridNeighbours <TileTypes>(new Vector2(tileX, tileY), grid);

                    List <TileTypes> currentNeighbours = gridNeighbours.GetNeighbours8(1);

                    if (tileX == debugTilePosition.x && tileY == debugTilePosition.y && debug)
                    {
                        Debug.Log("Looping trough neighbours");
                    }                     // Debug

                    // Loop trough every neighbour of a single tile
                    for (int neighbourIndex = 0; neighbourIndex < currentNeighbours.Count; neighbourIndex++)
                    {
                        if (tileX == debugTilePosition.x && tileY == debugTilePosition.y && debug)
                        {
                            for (int debugMessage0 = 0; debugMessage0 < currentNeighbours.Count; debugMessage0++)
                            {
                                Debug.Log("Neighbour with index " + debugMessage0 + ": " + currentNeighbours[debugMessage0]);
                            }
                        }                         // Debug

                        // If this tile is an edge tile
                        if (currentNeighbours[neighbourIndex] == TileTypes.Wall)
                        {
                            List <TileTypes> currentNeighboursInLine = gridNeighbours.GetNeighboursInLine(neighbourIndex, connectivitySize);

                            if (tileX == debugTilePosition.x && tileY == debugTilePosition.y && debug)
                            {
                                Debug.Log("neighbourIndex: " + neighbourIndex);
                                Debug.Log("currentNeighbours.Count: " + currentNeighbours.Count);
                                for (int debugMessage1 = 0; debugMessage1 < currentNeighboursInLine.Count; debugMessage1++)
                                {
                                    Debug.Log(currentNeighboursInLine[debugMessage1]);
                                }
                            }                             // Debug

                            // Loop trough every neighbour in a single line of a single tile
                            for (int neighbourInLineIndex = 0; neighbourInLineIndex < currentNeighboursInLine.Count; neighbourInLineIndex++)
                            {
                                // If there is a connectivity found at the other side of a wall
                                // TODO: check if the tile is within the same grid room
                                if (currentNeighboursInLine[neighbourInLineIndex] == TileTypes.Floor)
                                {
                                    if (tileX == debugTilePosition.x && tileY == debugTilePosition.y && debug)
                                    {
                                        Debug.Log("Connectivity found at index: " + neighbourInLineIndex);
                                    }                                     // Debug

                                    // Loop trough every tile between two connected grid tiles
                                    for (int connectivityInLineIndex = 0; connectivityInLineIndex < neighbourInLineIndex; connectivityInLineIndex++)
                                    {
                                        Vector2 connectivityNeighbourTile = new Vector2(tileX + (int)gridNeighbours.GetNeighboursPosition(neighbourIndex, connectivityInLineIndex + 1).x, tileY + (int)gridNeighbours.GetNeighboursPosition(neighbourIndex, connectivityInLineIndex + 1).y);

                                        if (tileX == debugTilePosition.x && tileY == debugTilePosition.y && debug)
                                        {
                                            Debug.Log("connectivityNeighbourTile: " + connectivityNeighbourTile);
                                        }                                         // Debug

                                        if (GridExt.IsInRange(grid, connectivityNeighbourTile))
                                        {
                                            tempGrid[(int)connectivityNeighbourTile.x, (int)connectivityNeighbourTile.y] = TileTypes.Floor;
                                        }

                                        GridNeighbours <TileTypes> connectivityGridNeighbours = new GridNeighbours <TileTypes>(connectivityNeighbourTile, grid);

                                        List <TileTypes> currentConnectivityNeighbours = connectivityGridNeighbours.GetNeighbours8(1);

                                        if (tileX == debugTilePosition.x && tileY == debugTilePosition.y && debug)
                                        {
                                            Debug.Log("connectivityTilePosition in GridNeighbours: " + new Vector2(connectivityGridNeighbours.TilePosition.x, connectivityGridNeighbours.TilePosition.y));
                                            for (int debugMessage2 = 0; debugMessage2 < currentConnectivityNeighbours.Count; debugMessage2++)
                                            {
                                                Debug.Log("currentConnectivityNeighbour at index " + debugMessage2 + ": " + currentConnectivityNeighbours[debugMessage2]);
                                            }
                                        }                                         // Debug

                                        for (int connectivityNeighbourIndex = 0; connectivityNeighbourIndex < currentConnectivityNeighbours.Count; connectivityNeighbourIndex++)
                                        {
                                            Vector2 connectivityNeighbourPosition = new Vector2(connectivityGridNeighbours.TilePosition.x + (int)connectivityGridNeighbours.GetNeighboursPosition(connectivityNeighbourIndex).x, connectivityGridNeighbours.TilePosition.y + (int)connectivityGridNeighbours.GetNeighboursPosition(connectivityNeighbourIndex).y);

                                            if (tileX == debugTilePosition.x && tileY == debugTilePosition.y && debug)
                                            {
                                                Debug.Log("connectivityNeighbourPosition: " + connectivityNeighbourPosition);
                                            }                                             // Debug

                                            if (GridExt.IsInRange(grid, connectivityNeighbourPosition))
                                            {
                                                tempGrid[(int)connectivityNeighbourPosition.x, (int)connectivityNeighbourPosition.y] = TileTypes.Floor;
                                            }
                                        }
                                    }

                                    break;
                                }
                            }
                        }
                    }
                }
            }

            return(tempGrid);
        }