/// <summary>
        /// called every frame
        /// </summary>
        public override void Update(float deltaTime)
        {
            //wait a delay
            if (delay > 0.0f)
            {
                delay -= deltaTime;
                return;
            }

            base.Update(deltaTime);

            //start counting time
            currentTime += deltaTime;

            //if time ends
            if (currentTime >= duration)
            {
                obj.position = to.position;

                CallOnUpdate();

                onComplete();
                return;
            }

            //get new value
            //Vector3 change = to.position - initialPos;
            //obj.position = Equations.ChangeVector( currentTime, initialPos, change, duration, ease );

            obj.position = EasingFunctions.ChangeVector(initialPos, to.position, currentTime / duration, ease);

            CallOnUpdate();
        }
コード例 #2
0
        /// <summary>
        /// called every frame
        /// </summary>
        public override void Update(float deltaTime)
        {
            if (isPause || isComplete)
            {
                return;
            }

            //wait a delay
            if (delay > 0.0f)
            {
                delay -= deltaTime;
                return;
            }

            base.Update(deltaTime);

            //start counting time
            currentTime += deltaTime;

            //if time ends
            if (currentTime >= duration)
            {
                if (onUpdateVector3 != null)
                {
                    onUpdateVector3(to);
                }

                if (onUpdateVector2 != null)
                {
                    onUpdateVector2(to);
                }

                onComplete();
                return;
            }

            //get new value
            Vector3 value = EasingFunctions.ChangeVector(from, to, currentTime / duration, ease);

            //call update if we have it
            if (onUpdateVector3 != null)
            {
                onUpdateVector3(value);
            }

            if (onUpdateVector2 != null)
            {
                onUpdateVector2(value);
            }
        }