コード例 #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);
    }
コード例 #2
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        LevelMaker ld = (LevelMaker)target;

        if (GUILayout.Button("Generate Level"))
        {
            ld.CreateLevel();
        }
    }
コード例 #3
0
 //after a level has been completed, it calls the different functions that each
 //component needs to reset itself. then it calls the other functions that belong
 //to the game manager to reset themselves.
 private void ResetLevel()
 {
     thisKey.ResetKey();
     thisLevel.ResetLevel();
     thisLevel.CreateLevel();
     thisTimer.ResetTimer();
     ResetIndexValues();
     ResetLocations();
     levelCount++;
     DisplayLevel();
 }