Territory/Assets/Game/Script/Utils/Tweening/UITweener.cs
/// <summary>
/// Update the tweening factor and call the virtual update function.
/// </summary>
Update the tweening factor and call the virtual update function.
Update the tweening factor and call the virtual update function .
void Update ()
	{
        float delta;
        float time;
        if (ignoreTimeScale)
        {
            delta = Time.unscaledDeltaTime;
            time = Time.unscaledTime;
        }
        else
        {
            delta = Time.deltaTime;
            time = Time.time;
        }
		if (!m_started)
		{
			delta = 0;
			m_started = true;
			m_startTime = time + delay;
		}
		if (time < m_startTime)
            return;
        if (delta > duration * 0.5)
            delta = m_firstDelta;
		m_factor += (duration == 0f) ? 1f : amountPerDelta * delta;
		if (style == Style.Loop)
		{
			if (m_factor > 1f)
                m_factor -= Mathf.Floor(m_factor);
		}
		else if (style == Style.PingPong)
		{
			if (m_factor > 1f)
			{
				m_factor = 1f - (m_factor - Mathf.Floor(m_factor));
				m_amountPerDelta = -m_amountPerDelta;
			}
			else if (m_factor < 0f)
			{
				m_factor = -m_factor;
				m_factor -= Mathf.Floor(m_factor);
				m_amountPerDelta = -m_amountPerDelta;
			}
		}
		if ((style == Style.Once) && (duration == 0f || m_factor > 1f || m_factor < 0f))
		{
			m_factor = Mathf.Clamp01(m_factor);
			Sample(m_factor, true);
			enabled = false;
			if (current != this)
			{
				UITweener before = current;
				current = this;
				if (onFinished != null)
                    onFinished();
				current = before;
			}
		}
		else
        {
            Sample(m_factor, false);
        }
	}
void Update ( ) { float delta ; float time ; if ( ignoreTimeScale ) { delta = Time . unscaledDeltaTime ; time = Time . unscaledTime ; } else { delta = Time . deltaTime ; time = Time . time ; } if ( ! m_started ) { delta = 0 ; m_started = true ; m_startTime = time + delay ; } if ( time < m_startTime ) return ; if ( delta > duration * 0.5 ) delta = m_firstDelta ; m_factor += ( duration == 0f ) ? 1f : amountPerDelta * delta ; if ( style == Style . Loop ) { if ( m_factor > 1f ) m_factor -= Mathf . Floor ( m_factor ) ; } else if ( style == Style . PingPong ) { if ( m_factor > 1f ) { m_factor = 1f - ( m_factor - Mathf . Floor ( m_factor ) ) ; m_amountPerDelta = - m_amountPerDelta ; } else if ( m_factor < 0f ) { m_factor = - m_factor ; m_factor -= Mathf . Floor ( m_factor ) ; m_amountPerDelta = - m_amountPerDelta ; } } if ( ( style == Style . Once ) && ( duration == 0f || m_factor > 1f || m_factor < 0f ) ) { m_factor = Mathf . Clamp01 ( m_factor ) ; Sample ( m_factor , true ) ; enabled = false ; if ( current != this ) { UITweener before = current ; current = this ; if ( onFinished != null ) onFinished ( ) ; current = before ; } } else { Sample ( m_factor , false ) ; } }
Update the tweening factor and call the virtual update function.
Update the tweening factor and call the virtual update function .