Beispiel #1
0
    private void LoadLevel()
    {
        _currentLevel = PlayerPrefs.GetInt("CurrentLevel", 0);

        LevelImporter importer = new LevelImporter();

        _levels = importer.loadMetadata(Resources.Load <TextAsset>("levels").text);

        if (levelName != null)
        {
            levelName.text = _levels.levels[_currentLevel].title;
        }
        rewindButton.SetActive(_levels.levels[_currentLevel].rewindCount != 0);

        if (_camera != null)
        {
            SmoothCamera sc = GetComponent <SmoothCamera>();
            sc.ClearBackgrounds();
            for (int i = 0; i < _levels.levels[_currentLevel].background.Length; ++i)
            {
                sc.AddBackground(_levels.levels[_currentLevel].background[i]);
            }
        }
        LoadLevelObjects(importer);
    }