using System.Collections; using System.Collections.Generic; using UnityEngine; namespace AC { [RequireComponent (typeof (ParticleSystem))] public class RememberParticle : Remember { public override string SaveData () { ParticleData particleData = new ParticleData (); particleData.isOn = GetComponent <ParticleSystem> ().isPlaying; particleData.objectID = constantID; return Serializer.SaveScriptData <ParticleData> (particleData); } public override void LoadData (string stringData) { ParticleData data = Serializer.LoadScriptData <ParticleData> (stringData); if (data == null) return; if(data.isOn) GetComponent <ParticleSystem> ().Play(); } [System.Serializable] public class ParticleData : RememberData { public bool isOn; public ParticleData () { } } } }
themightyzq