IsAlive() private method

private IsAlive ( ) : bool
return bool
    static int IsAlive(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1)
            {
                UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem));
                bool o = obj.IsAlive();
                LuaDLL.lua_pushboolean(L, o);
                return(1);
            }
            else if (count == 2)
            {
                UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.CheckObject(L, 1, typeof(UnityEngine.ParticleSystem));
                bool arg0 = LuaDLL.luaL_checkboolean(L, 2);
                bool o    = obj.IsAlive(arg0);
                LuaDLL.lua_pushboolean(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.ParticleSystem.IsAlive"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Example #2
0
 void Update()
 {
     if (!particleSystem.IsAlive())
     {
         PoolManager.DestroyObject(this);
     }
 }
Example #3
0
 static public int IsAlive(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 1)
         {
             UnityEngine.ParticleSystem self = (UnityEngine.ParticleSystem)checkSelf(l);
             var ret = self.IsAlive();
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (argc == 2)
         {
             UnityEngine.ParticleSystem self = (UnityEngine.ParticleSystem)checkSelf(l);
             System.Boolean             a1;
             checkType(l, 2, out a1);
             var ret = self.IsAlive(a1);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #4
0
 IEnumerator CleanupExplosion(ParticleSystem explosion)
 {
     while (explosion.IsAlive()) {
         yield return new WaitForEndOfFrame ();
     }
     Destroy (explosion.gameObject);
 }
 static int QPYX_IsAlive_YXQP(IntPtr L_YXQP)
 {
     try
     {
         int QPYX_count_YXQP = LuaDLL.lua_gettop(L_YXQP);
         if (QPYX_count_YXQP == 1)
         {
             UnityEngine.ParticleSystem QPYX_obj_YXQP = (UnityEngine.ParticleSystem)ToLua.CheckObject(L_YXQP, 1, typeof(UnityEngine.ParticleSystem));
             bool QPYX_o_YXQP = QPYX_obj_YXQP.IsAlive();
             LuaDLL.lua_pushboolean(L_YXQP, QPYX_o_YXQP);
             return(1);
         }
         else if (QPYX_count_YXQP == 2)
         {
             UnityEngine.ParticleSystem QPYX_obj_YXQP = (UnityEngine.ParticleSystem)ToLua.CheckObject(L_YXQP, 1, typeof(UnityEngine.ParticleSystem));
             bool QPYX_arg0_YXQP = LuaDLL.luaL_checkboolean(L_YXQP, 2);
             bool QPYX_o_YXQP    = QPYX_obj_YXQP.IsAlive(QPYX_arg0_YXQP);
             LuaDLL.lua_pushboolean(L_YXQP, QPYX_o_YXQP);
             return(1);
         }
         else
         {
             return(LuaDLL.luaL_throw(L_YXQP, "invalid arguments to method: UnityEngine.ParticleSystem.IsAlive"));
         }
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
    IEnumerator CheckIfAlive()
    {
        UnityEngine.ParticleSystem ps = this.GetComponent <UnityEngine.ParticleSystem>();

        while (true && ps != null)
        {
            yield return(new WaitForSeconds(0.5f));

            if (!ps.IsAlive(true))
            {
                if (OnlyDeactivate)
                {
                                        #if UNITY_3_5
                    this.gameObject.SetActiveRecursively(false);
                                        #else
                    this.gameObject.SetActive(false);
                                        #endif
                }
                else
                {
                    GameObject.Destroy(this.gameObject);
                }
                break;
            }
        }
    }
 static public int IsAlive(IntPtr l)
 {
     try{
         if (matchType(l, 2))
         {
             UnityEngine.ParticleSystem self = (UnityEngine.ParticleSystem)checkSelf(l);
             System.Boolean             ret  = self.IsAlive();
             pushValue(l, ret);
             return(1);
         }
         else if (matchType(l, 2, typeof(bool)))
         {
             UnityEngine.ParticleSystem self = (UnityEngine.ParticleSystem)checkSelf(l);
             System.Boolean             a1;
             checkType(l, 2, out a1);
             System.Boolean ret = self.IsAlive(a1);
             pushValue(l, ret);
             return(1);
         }
         LuaDLL.luaL_error(l, "No matched override function to call");
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static public int IsAlive(IntPtr l)
 {
     try {
         UnityEngine.ParticleSystem self = (UnityEngine.ParticleSystem)checkSelf(l);
         var ret = self.IsAlive();
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #9
0
        static int _m_IsAlive(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            UnityEngine.ParticleSystem __cl_gen_to_be_invoked = (UnityEngine.ParticleSystem)translator.FastGetCSObj(L, 1);


            int __gen_param_count = LuaAPI.lua_gettop(L);

            try {
                if (__gen_param_count == 1)
                {
                    bool __cl_gen_ret = __cl_gen_to_be_invoked.IsAlive(  );
                    LuaAPI.lua_pushboolean(L, __cl_gen_ret);



                    return(1);
                }
                if (__gen_param_count == 2 && LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 2))
                {
                    bool withChildren = LuaAPI.lua_toboolean(L, 2);

                    bool __cl_gen_ret = __cl_gen_to_be_invoked.IsAlive(withChildren);
                    LuaAPI.lua_pushboolean(L, __cl_gen_ret);



                    return(1);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.ParticleSystem.IsAlive!"));
        }
 static public int IsAlive__Boolean(IntPtr l)
 {
     try {
         UnityEngine.ParticleSystem self = (UnityEngine.ParticleSystem)checkSelf(l);
         System.Boolean             a1;
         checkType(l, 2, out a1);
         var ret = self.IsAlive(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #11
0
    public IEnumerator AutoReleaseParticle(string prefabName, ParticleSystem particle, PrefabPoolAgent agent)
    {
        yield return new WaitForSeconds(particle.startDelay + 0.25f);

        GameObject go = particle.gameObject;
        while (particle.IsAlive(true) && go.activeInHierarchy)
        {
            yield return null;
        }

        if (go.activeInHierarchy)
        {
            Despawn(prefabName, agent);
            particle.Clear(true);
        }
    }
    static int IsAlive(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 1 && ToLua.CheckTypes(L, 1, typeof(UnityEngine.ParticleSystem)))
        {
            UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.ToObject(L, 1);
            bool o;

            try
            {
                o = obj.IsAlive();
            }
            catch (Exception e)
            {
                return(LuaDLL.toluaL_exception(L, e));
            }

            LuaDLL.lua_pushboolean(L, o);
            return(1);
        }
        else if (count == 2 && ToLua.CheckTypes(L, 1, typeof(UnityEngine.ParticleSystem), typeof(bool)))
        {
            UnityEngine.ParticleSystem obj = (UnityEngine.ParticleSystem)ToLua.ToObject(L, 1);
            bool arg0 = LuaDLL.lua_toboolean(L, 2);
            bool o;

            try
            {
                o = obj.IsAlive(arg0);
            }
            catch (Exception e)
            {
                return(LuaDLL.toluaL_exception(L, e));
            }

            LuaDLL.lua_pushboolean(L, o);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: UnityEngine.ParticleSystem.IsAlive");
        }

        return(0);
    }
	static public int IsAlive(IntPtr l) {
		try {
			#if DEBUG
			var method = System.Reflection.MethodBase.GetCurrentMethod();
			string methodName = GetMethodName(method);
			#if UNITY_5_5_OR_NEWER
			UnityEngine.Profiling.Profiler.BeginSample(methodName);
			#else
			Profiler.BeginSample(methodName);
			#endif
			#endif
			int argc = LuaDLL.lua_gettop(l);
			if(argc==1){
				UnityEngine.ParticleSystem self=(UnityEngine.ParticleSystem)checkSelf(l);
				var ret=self.IsAlive();
				pushValue(l,true);
				pushValue(l,ret);
				return 2;
			}
			else if(argc==2){
				UnityEngine.ParticleSystem self=(UnityEngine.ParticleSystem)checkSelf(l);
				System.Boolean a1;
				checkType(l,2,out a1);
				var ret=self.IsAlive(a1);
				pushValue(l,true);
				pushValue(l,ret);
				return 2;
			}
			pushValue(l,false);
			LuaDLL.lua_pushstring(l,"No matched override function IsAlive to call");
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
		#if DEBUG
		finally {
			#if UNITY_5_5_OR_NEWER
			UnityEngine.Profiling.Profiler.EndSample();
			#else
			Profiler.EndSample();
			#endif
		}
		#endif
	}
        protected IEnumerator ListenToDespawn(ParticleSystem emitter)
        {
            // Wait for the delay time to complete
            // Waiting the extra frame seems to be more stable and means at least one 
            //  frame will always pass
            yield return new WaitForSeconds(emitter.startDelay + 0.25f);
						
            while (emitter.IsAlive(true))
            {
                if (!emitter.gameObject.activeInHierarchy)
                {
                    emitter.Clear(true);
                    yield break;  // Do nothing, already despawned. Quit.
                }

                yield return null;
            }

            // Turn off emit before despawning
            InstanceManager.Despawn(this.poolName, emitter.transform);
        }
        private IEnumerator ListenForEmitDespawn(ParticleSystem emitter)
        {
            yield return new WaitForSeconds(emitter.startDelay + 0.25f);

            float safetimer = 0;
            GameObject emitterGO = emitter.gameObject;
            while (emitter.IsAlive(true) && emitterGO.activeInHierarchy)
            {
                safetimer += Time.deltaTime;
                if (safetimer > MaxParticleDespawnTime)
                {
                    Debug.LogWarning
                    (
                          string.Format
                          (
                              "SpawnPool {0}: " +
                                  "Timed out while listening for all particles to die. " +
                                  "Waited for {1}sec.", PoolName, MaxParticleDespawnTime
                          )
                      );
                }
                yield return null;
            }

            if (emitterGO.activeInHierarchy)
            {
                Despawn(emitter.transform);
                emitter.Clear(true);
            }
        }
Example #16
0
 void Awake()
 {
     PS = GetComponent<ParticleSystem>();
     PS.IsAlive();
 }
        private IEnumerator Destroy_Particle_System_When_Done( ParticleSystem particle_system )
        {
            while( particle_system.IsAlive() )
            {
                yield return new WaitForSeconds( 1f );
            }

            Object.Destroy( particle_system.gameObject );
        }