Ejemplo n.º 1
0
        public override string SaveData()
        {
            ParticleSystemData particleSystemData = new ParticleSystemData();

            particleSystemData.objectID      = constantID;
            particleSystemData.savePrevented = savePrevented;

            ParticleSystem particleSystem = GetComponent <ParticleSystem>();

            if (particleSystem != null)
            {
                particleSystemData.isPlaying   = particleSystem.isPlaying;
                particleSystemData.isPaused    = particleSystem.isPaused;
                particleSystemData.currentTime = particleSystem.time;
            }

            return(Serializer.SaveScriptData <ShapeableData> (particleSystemData));
        }
Ejemplo n.º 2
0
        public override void LoadData(string stringData)
        {
            ParticleSystemData data = Serializer.LoadScriptData <ParticleSystemData> (stringData);

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

            ParticleSystem particleSystem = GetComponent <ParticleSystem>();

            if (particleSystem != null)
            {
                particleSystem.time = data.currentTime;
                if (data.isPlaying)
                {
                    particleSystem.Simulate(data.currentTime);
                    particleSystem.Play();
                }
                else
                {
                    if (data.isPaused)
                    {
                        particleSystem.Pause();
                    }
                    else
                    {
                        particleSystem.Stop();
                    }
                }
                particleSystem.time = data.currentTime;
            }
        }