public void TweenValue(float floatPercentage) { if (!ValidOnChangedTarget()) { return; } var newColor = Color.Lerp(m_StartColor, m_TargetColor, floatPercentage); if (m_TweenMode == ColorTweenMode.Alpha) { newColor.r = m_StartColor.r; newColor.g = m_StartColor.g; newColor.b = m_StartColor.b; } else if (m_TweenMode == ColorTweenMode.RGB) { newColor.a = m_StartColor.a; } m_OnChangedTarget.Invoke(newColor); if ((m_OnCompleteTarget != null) && Math.Abs(floatPercentage - 1f) < Mathf.Epsilon) { m_OnCompleteTarget.Invoke(); } }
public void TweenValue(float floatPercentage) { if (!ValidTarget()) { return; } var newColor = Color.Lerp(m_StartColor, m_TargetColor, floatPercentage); if (m_TweenMode == ColorTweenMode.Alpha) { newColor.r = m_StartColor.r; newColor.g = m_StartColor.g; newColor.b = m_StartColor.b; } else if (m_TweenMode == ColorTweenMode.RGB) { newColor.a = m_StartColor.a; } m_Target.Invoke(newColor); }
public void TweenValue(float floatPercentage) { if (ValidTarget()) { Color arg = Color.Lerp(m_StartColor, m_TargetColor, floatPercentage); if (m_TweenMode == ColorTweenMode.Alpha) { arg.r = m_StartColor.r; arg.g = m_StartColor.g; arg.b = m_StartColor.b; } else if (m_TweenMode == ColorTweenMode.RGB) { arg.a = m_StartColor.a; } m_Target.Invoke(arg); } }