示例#1
0
        /// <summary>
        /// adds the IEnumerator to the CoroutineManager. Coroutines get ticked before Update is called each frame.
        /// </summary>
        /// <returns>The coroutine.</returns>
        /// <param name="enumerator">Enumerator.</param>
        public ICoroutine startCoroutine(IEnumerator enumerator)
        {
            // find or create a CoroutineImpl
            var coroutine = QuickCache <CoroutineImpl> .pop();

            coroutine.prepareForReuse();

            // setup the coroutine and add it
            coroutine.enumerator = enumerator;
            var shouldContinueCoroutine = tickCoroutine(coroutine);

            // guard against empty coroutines
            if (!shouldContinueCoroutine || coroutine.isDone)
            {
                coroutine.recycle();
                QuickCache <CoroutineImpl> .push(coroutine);

                return(null);
            }

            if (_isInUpdate)
            {
                _shouldRunNextFrame.Add(coroutine);
            }
            else
            {
                _unblockedCoroutines.Add(coroutine);
            }

            return(coroutine);
        }
示例#2
0
        /// <summary>
        /// adds a Particle to the emitter
        /// </summary>
        void addParticle()
        {
            // take the next particle out of the particle pool we have created and initialize it
            var particle = QuickCache <Particle> .pop();

            particle.initialize(_emitterConfig);
            _particles.Add(particle);
        }
示例#3
0
        public static ITween <Vector3> vector3PropertyTo(object self, string propertyName, Vector3 to, float duration)
        {
            var tweenTarget = new PropertyTarget <Vector3>(self, propertyName);
            var tween       = TweenManager.cacheVector3Tweens ? QuickCache <Vector3Tween> .pop() : new Vector3Tween();

            tween.initialize(tweenTarget, to, duration);

            return(tween);
        }
示例#4
0
        public static ITween <float> floatPropertyTo(object self, string propertyName, float to, float duration)
        {
            var tweenTarget = new PropertyTarget <float>(self, propertyName);
            var tween       = TweenManager.cacheFloatTweens ? QuickCache <FloatTween> .pop() : new FloatTween();

            tween.initialize(tweenTarget, to, duration);

            return(tween);
        }
示例#5
0
        public static ITween <Color> colorPropertyTo(object self, string propertyName, Color to, float duration)
        {
            var tweenTarget = new PropertyTarget <Color>(self, propertyName);
            var tween       = TweenManager.cacheColorTweens ? QuickCache <ColorTween> .pop() : new ColorTween();

            tween.initialize(tweenTarget, to, duration);

            return(tween);
        }
示例#6
0
        public static ITween <Quaternion> quaternionPropertyTo(object self, string propertyName, Quaternion to, float duration)
        {
            var tweenTarget = new PropertyTarget <Quaternion>(self, propertyName);
            var tween       = TweenManager.cacheQuaternionTweens ? QuickCache <QuaternionTween> .pop() : new QuaternionTween();

            tween.initialize(tweenTarget, to, duration);

            return(tween);
        }
示例#7
0
        /// <summary>
        /// schedules a one-time or repeating timer that will call the passed in Action
        /// </summary>
        /// <param name="timeInSeconds">Time in seconds.</param>
        /// <param name="repeats">If set to <c>true</c> repeats.</param>
        /// <param name="context">Context.</param>
        /// <param name="onTime">On time.</param>
        internal ITimer schedule(float timeInSeconds, bool repeats, object context, Action <ITimer> onTime)
        {
            var timer = QuickCache <Timer> .pop();

            timer.initialize(timeInSeconds, repeats, context, onTime);
            _timers.Add(timer);

            return(timer);
        }
示例#8
0
文件: Tweens.cs 项目: Pyxlre/Nez
 public static Vector2Tween create()
 {
     return(TweenManager.cacheVector2Tweens ? QuickCache <Vector2Tween> .pop() : new Vector2Tween());
 }
示例#9
0
文件: Tweens.cs 项目: Pyxlre/Nez
 public static FloatTween create()
 {
     return(TweenManager.cacheFloatTweens ? QuickCache <FloatTween> .pop() : new FloatTween());
 }
示例#10
0
文件: Tweens.cs 项目: Pyxlre/Nez
 public static RectangleTween create()
 {
     return(TweenManager.cacheRectTweens ? QuickCache <RectangleTween> .pop() : new RectangleTween());
 }
示例#11
0
文件: Tweens.cs 项目: Pyxlre/Nez
 public static ColorTween create()
 {
     return(TweenManager.cacheColorTweens ? QuickCache <ColorTween> .pop() : new ColorTween());
 }
示例#12
0
文件: Tweens.cs 项目: Pyxlre/Nez
 public static QuaternionTween create()
 {
     return(TweenManager.cacheQuaternionTweens ? QuickCache <QuaternionTween> .pop() : new QuaternionTween());
 }
示例#13
0
文件: Tweens.cs 项目: Pyxlre/Nez
 public static IntTween create()
 {
     return(TweenManager.cacheIntTweens ? QuickCache <IntTween> .pop() : new IntTween());
 }