Пример #1
0
    private void LevelLoaded(Scene level, LoadSceneMode loadMode)
    {
        if (level.buildIndex != 0)
        {
            if (!firstLevelLoaded)
            {
                InitializeHUD();
                firstLevelLoaded = true;
            }

            LevelLoader load = FindObjectOfType <LevelLoader>();
            load.EnemySpawn(level.buildIndex);
            load.PlayerSpawn(players);

            musicController = FindObjectOfType <MusicController>();
            cameraManager.SetCameras(resetting);
            uiManager.SetMenuButtons(resetting);

            foreach (PatternSynch ps in FindObjectsOfType <PatternSynch>())
            {
                ps.SetObjectsReferences();
            }

            FindObjectOfType <BeatSynch>().SetupBeatTime();
            musicController.SetCharactersBeatDependencies();

            if (resetting)
            {
                foreach (PatternSynch p in FindObjectsOfType <PatternSynch>())
                {
                    p.Reset();
                }
                Pause();
                resetting = false;
            }
            else
            {
                currentGameState = PLAYINGSTATE;
            }
        }
        else
        {
            foreach (CanvasConfig cc in FindObjectsOfType <CanvasConfig>())
            {
                Destroy(cc.gameObject);
            }
        }
    }