Esempio n. 1
0
        /// <summary>
        /// called every frame
        /// </summary>
        public override void Update(float delta)
        {
            //wait a delay
            if (m_delay > 0.0f)
            {
                m_delay -= delta;
                return;
            }

            //start counting time
            m_currentTime += delta;

            //if time ends
            if (m_currentTime >= m_duration)
            {
                if (m_onUpdateVector3 != null)
                {
                    m_onUpdateVector3(m_to);
                }

                m_onComplete();
                return;
            }

            //get new value
            Vector3 change = m_to - m_from;
            Vector3 value  = Equations.ChangeVector(m_currentTime, m_from, change, m_duration, m_ease);

            //call update if we have it
            if (m_onUpdateVector3 != null)
            {
                m_onUpdateVector3(value);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// called every frame
        /// </summary>
        public override void Update(float delta)
        {
            //wait a delay
            if (m_delay > 0.0f)
            {
                m_delay -= delta;
                return;
            }



            //start counting time
            m_currentTime += delta;

            Debug.Log(m_currentTime);

            //if time ends
            if (m_currentTime >= m_duration)
            {
                m_object.position = m_to.position;

                m_onComplete();

                if (m_onUpdateTransform != null)
                {
                    m_onUpdateTransform(m_object);
                }
                return;
            }

            //get new value
            Vector3 change = m_to.position - m_initialPos;

            m_object.position = Equations.ChangeVector(m_currentTime, m_initialPos, change, m_duration, m_ease);

            //call update if we have it
            if (m_onUpdateTransform != null)
            {
                m_onUpdateTransform(m_object);
            }
        }