/**
         * <summary>Deserialises a string of data, and restores the GameObject to its previous state.</summary>
         * <param name = "stringData">The data, serialised as a string</param>
         * <param name = "restoringSaveFile">True if the game is currently loading a saved game file, as opposed to just switching scene</param>
         */
        public override void LoadData(string stringData, bool restoringSaveFile = false)
        {
            SoundData data = Serializer.LoadScriptData <SoundData> (stringData);

            if (data == null)
            {
                return;
            }
            SavePrevented = data.savePrevented; if (savePrevented)
            {
                return;
            }

            Sound sound = GetComponent <Sound>();

            if (sound is Music)
            {
                return;
            }

            if (!restoringSaveFile && sound.surviveSceneChange)
            {
                return;
            }

            sound.LoadData(data);
        }
Exemple #2
0
        public override void LoadData(string stringData)
        {
            SoundData data = Serializer.LoadScriptData <SoundData> (stringData);

            if (data == null)
            {
                return;
            }
            SavePrevented = data.savePrevented; if (savePrevented)
            {
                return;
            }

            Sound sound = GetComponent <Sound>();

            if (sound is Music)
            {
                return;
            }

            if (KickStarter.saveSystem.loadingGame == LoadingGame.No && sound.surviveSceneChange)
            {
                return;
            }

            sound.LoadData(data);
        }