public static List <Vector2Int> GeneratePath(int[,] mapValues)
    {
        List <Vector2Int> walkable = new List <Vector2Int>();
        Vector2Int        start    = Vector2Int.zero;
        Vector2Int        end      = Vector2Int.zero;

        for (int x = 0; x < mapValues.GetLength(0); x++)
        {
            for (int y = 0; y < mapValues.GetLength(1); y++)
            {
                int      number = mapValues[x, y];
                TileType type   = TileMethods.TypeById[number];
                if (TileMethods.IsWalkable(type))
                {
                    walkable.Add(new Vector2Int(x, y));
                }
                switch (type)
                {
                case TileType.Start: start = new Vector2Int(x, y); break;

                case TileType.End: end = new Vector2Int(x, y); break;

                default: break;
                }
            }
        }
        AI.IPathFinder pathFinder = new AI.Dijkstra(walkable);
        walkable = (List <Vector2Int>)pathFinder.FindPath(start, end);
        return(walkable);
    }
    private void Awake()
    {
        fileReader = transform.GetComponent <FileReader>();

        fileReader.Read(mapName);

        waveData = fileReader.getWaveData;

        if (!DictionaryObject)
        {
            DictionaryObject = Instantiate(DictionaryPrefab);
            DictionaryObject.transform.parent = transform;

            DictionaryObject.GetComponent <TileDictionary>().SetupDictionary();
            DictionaryObject.GetComponent <UnitDictionary>().SetupDictionary();
        }

        if (!MapBuilderObject)
        {
            MapBuilderObject = Instantiate(MapBuilderPrefab);
            MapBuilderObject.transform.parent = transform;

            builder                   = MapBuilderObject.GetComponent <MapBuilder>();
            builder.setMap            = fileReader.getMapData;
            builder.setTileDictionary = DictionaryObject.GetComponent <TileDictionary>();
            builder.BuildMap();
        }

        dijkstra = new AI.Dijkstra(builder.getPath);

        if (!UnitManager)
        {
            UnitManager = Instantiate(UnitManagerPrefab);
            UnitManager.transform.parent = transform;

            UnitManager.GetComponent <UnitManager>().setUnitDictionary = DictionaryObject.GetComponent <UnitDictionary>();
            UnitManager.GetComponent <UnitManager>().setPath           = (List <Vector2Int>)dijkstra.FindPath(builder.getStart, builder.getEnd);
            UnitManager.GetComponent <UnitManager>().RunWave(waveData[currentWave].x, waveData[currentWave].y);
        }

        if (!PlayerManager)
        {
            PlayerManager = Instantiate(PlayerManagerPrefab);
            PlayerManager.transform.parent = transform;
            PlayerManager.GetComponent <PlayerHealthListener>().SetupListener(HealthPanel.transform.Find("HealthText").gameObject.GetComponent <Text>());
            PlayerManager.GetComponent <PlayerBehaviour>().setupPlayer();
        }
    }