Example #1
0
    // Load the game data and game state, if it fails return to start menu with en error
    void initGameData()
    {
        //mapGenerator.begin();
        if (StartMenu.startNew)
        {
            // Initialize the 2D array
            // For testing, Simulates autopopulating the player units with
            // starting amount of units when game is started
            for (int add = 0; add < initialPlayerUnitCount; add++) //********************************************************** CHANGE ME LATER *************
            {
                addNewUnit(true, add, 0);
            }

            tileManager.Init();
            currentUserTile = new Vector2(0, 0);
            allEnemyUnits = new List<List<UnitClass>>();
            generateAllEnemies();
        }
        else
        {
            gameStateManager = GameObject.Find("MenuCanvas").GetComponent<GameStateManager>();
            gameStateManager.loadGameData();
        }
    }