Exemplo n.º 1
0
 protected virtual void Awake()
 {
     this.uiParticleSystem = (UIParticleRenderer)((Component)this).GetComponent <UIParticleRenderer>();
     if (!Object.op_Implicit((Object)this.imageRenderer))
     {
         if (this.verboseDebug)
         {
             Debug.LogWarning((object)"Image Renderer not defined, must be defined in order for the system to work");
         }
         this.isPlaying = false;
     }
     if (!Object.op_Implicit((Object)this.particlesSystem))
     {
         this.particlesSystem = (ParticleSystem)((Component)this).GetComponent <ParticleSystem>();
         if (!Object.op_Implicit((Object)this.particlesSystem))
         {
             if (!this.verboseDebug)
             {
                 return;
             }
             Debug.LogError((object)"No particle system found. Static Sprite Emission won't work");
             return;
         }
     }
     this.mainModule = this.particlesSystem.get_main();
     ((ParticleSystem.MainModule) ref this.mainModule).set_loop(false);
     ((ParticleSystem.MainModule) ref this.mainModule).set_playOnAwake(false);
     this.particlesSystem.Stop();
     this.SimulationSpace = ((ParticleSystem.MainModule) ref this.mainModule).get_simulationSpace();
 }
Exemplo n.º 2
0
        /// <summary>
        /// Obtain needed references and define base variables.
        /// </summary>
        protected virtual void Awake()
        {
            uiParticleSystem = GetComponent <UIParticleRenderer>();

            //uiParticleSystem.GetComponent<UIParticleSystem>().hideFlags = HideFlags.HideInInspector;
            //Find Renderer in current gameObject if non is draggued
            if (!imageRenderer)
            {
                if (verboseDebug)
                {
                    Debug.LogWarning("Image Renderer not defined, must be defined in order for the system to work");
                }
                isPlaying = false;
            }

            //Find Particle System in current gameObject if non is draggued
            if (!particlesSystem)
            {
                particlesSystem = GetComponent <ParticleSystem>();
                if (!particlesSystem)
                {
                    if (verboseDebug)
                    {
                        Debug.LogError("No particle system found. Static Sprite Emission won't work");
                    }
                    return;
                }
            }

            //Set base varibles in the system for this emitter work as expected
            #if UNITY_5_5_OR_NEWER
            mainModule             = particlesSystem.main;
            mainModule.loop        = false;
            mainModule.playOnAwake = false;
            particlesSystem.Stop();
            //validate simulation Space
            SimulationSpace = mainModule.simulationSpace;
            #else
            particlesSystem.loop        = false;
            particlesSystem.playOnAwake = false;
            particlesSystem.Stop();
            //validate simulation Space
            SimulationSpace = particlesSystem.simulationSpace;
            #endif
        }