Exemple #1
0
    //Ready for the next level?
    public void NextLevel()
    {
        chaos = 0;
        level++;
        maxChaos   = level * 50;
        maxEnemies = level * 10;

        //Destroy player and enemies
        GameObject player = GameObject.FindGameObjectWithTag("Player");

        if (player != null)
        {
            Destroy(player);
        }

        enemySpawner.ClearEnemies();
        enemySpawner.StopSpawning();

        //GENERATE NEW LEVEL
        LevelGenerator.GenerateLevel(levelManager.levelPrototype);
        levelManager.CreateLevel();

        enemySpawner.BeginSpawning();

        //Set player position
        Instantiate(playerPrefab, Level.StartGate.position, Quaternion.identity);
    }