コード例 #1
0
    public void GenerateLevel()
    {
        //Nécessaire, ne pas enlever
        EnemySpawn.InitSpawns();
        PlayerSpawn.InitSpawns();
        cameras     = new Camera[4];
        arenaScenes = new Scene[4];

        arenasLeftToSpawn = levels[currentLevel].arenasToSpawnCount;
        //SceneLoader.AddArenas(levels[currentLevel].arenas, levels[currentLevel].arenasToSpawnCount);

        SceneManager.sceneLoaded += OnSceneAdded;
        if (!useSave)
        {
            int random = Random.Range(0, levels[currentLevel].arenas.Count);
            while (currentArenaIndex == random)
            {
                random = Random.Range(0, levels[currentLevel].arenas.Count);
            }
            currentArenaIndex = random;
        }
        else
        {
            currentArenaIndex = SaveManager.instance.playerDatas[0].arenaIndexes[levels[currentLevel].arenas.Count - arenasLeftToSpawn];
        }
        selectedArenaIndexes = new List <int>()
        {
            currentArenaIndex
        };
        SceneManager.LoadScene(levels[currentLevel].arenas[currentArenaIndex].sceneName, LoadSceneMode.Additive);
    }