Beispiel #1
0
        private void BeforeStopEmitter(uint timerId, object cookie)
        {
            List <uint> list = this.beforeStopTimerIds;

            if (list != null)
            {
                int count = list.Count;
                for (int i = 0; i < count; i++)
                {
                    if (list[i] == timerId)
                    {
                        list.RemoveAt(i);
                        break;
                    }
                }
            }
            EmitterPoolCookie emitterPoolCookie = (EmitterPoolCookie)cookie;

            emitterPoolCookie.EmitterStop(emitterPoolCookie.Cookie);
            if (MathUtils.IsGreaterThanZero(emitterPoolCookie.DelayPostEmitterStop))
            {
                timerId = Service.ViewTimerManager.CreateViewTimer(emitterPoolCookie.DelayPostEmitterStop, false, new TimerDelegate(this.AfterStopEmitter), emitterPoolCookie);
                this.AddAfterStopTimerId(timerId);
            }
            else
            {
                this.AfterStopEmitter(0u, emitterPoolCookie);
            }
        }
Beispiel #2
0
        protected void StopEmitterAndReturnToPool(object cookie, float delayPreEmitterStop, EmitterStopDelegate emitterStop, float delayPostEmitterStop, EmitterStopDelegate postEmitterStop)
        {
            EmitterPoolCookie cookie2 = new EmitterPoolCookie(cookie, emitterStop, delayPostEmitterStop, postEmitterStop);

            if (MathUtils.IsGreaterThanZero(delayPreEmitterStop))
            {
                uint timerId = Service.Get <ViewTimerManager>().CreateViewTimer(delayPreEmitterStop, false, new TimerDelegate(this.BeforeStopEmitter), cookie2);
                this.AddBeforeStopTimerId(timerId);
                return;
            }
            this.BeforeStopEmitter(0u, cookie2);
        }
Beispiel #3
0
        private void AfterStopEmitter(uint timerId, object cookie)
        {
            if (this.afterStopTimerIds != null)
            {
                this.afterStopTimerIds.Remove(timerId);
            }
            EmitterPoolCookie emitterPoolCookie = (EmitterPoolCookie)cookie;

            emitterPoolCookie.PostEmitterStop(emitterPoolCookie.Cookie);
            if (this.emitterReturnedToPool != null)
            {
                this.emitterReturnedToPool(emitterPoolCookie.Cookie);
            }
        }
Beispiel #4
0
        private void BeforeStopEmitter(uint timerId, object cookie)
        {
            if (this.beforeStopTimerIds != null)
            {
                this.beforeStopTimerIds.Remove(timerId);
            }
            EmitterPoolCookie emitterPoolCookie = (EmitterPoolCookie)cookie;

            emitterPoolCookie.EmitterStop(emitterPoolCookie.Cookie);
            if (MathUtils.IsGreaterThanZero(emitterPoolCookie.DelayPostEmitterStop))
            {
                timerId = Service.Get <ViewTimerManager>().CreateViewTimer(emitterPoolCookie.DelayPostEmitterStop, false, new TimerDelegate(this.AfterStopEmitter), emitterPoolCookie);
                this.AddAfterStopTimerId(timerId);
                return;
            }
            this.AfterStopEmitter(0u, emitterPoolCookie);
        }