private void SpawnObstacles() { ItemSpawner itemSpawner = GameManager.instance.GetComponent <ItemSpawner>(); for (int x = -GameManager.instance.mapSizeX; x < GameManager.instance.mapSizeX; x++) { for (int y = -GameManager.instance.mapSizeY; y < GameManager.instance.mapSizeY; y++) { if (bottomMap.GetTile(new Vector3Int(x, y, 0)) == null) { //Debug.Log("x " + x + ". y " + y); } else { itemSpawner.RollChanceToPlaceObstacleOnTile(bottomMap.GetCellCenterWorld(new Vector3Int(x, y, 0)), new Vector3Int(x, y, 0)); } } } }