public void Update() { if (!m_Easing || DelayIfNeeded()) { return; } var progress = Easing.ByType(m_EasingType, Time.time - m_StartingTime, 0, 1, m_Duration); if (Time.time - m_StartingTime <= m_Duration) { var x = (Mathf.Abs(progress) * (m_EndingPosition.x - m_StartingPosition.x)) + m_StartingPosition.x; var y = (Mathf.Abs(progress) * (m_EndingPosition.y - m_StartingPosition.y)) + m_StartingPosition.y; var z = (Mathf.Abs(progress) * (m_EndingPosition.z - m_StartingPosition.z)) + m_StartingPosition.z; transform.position = new Vector3(x, y, z); } else { progress = 1; var x = (Mathf.Abs(progress) * (m_EndingPosition.x - m_StartingPosition.x)) + m_StartingPosition.x; var y = (Mathf.Abs(progress) * (m_EndingPosition.y - m_StartingPosition.y)) + m_StartingPosition.y; var z = (Mathf.Abs(progress) * (m_EndingPosition.z - m_StartingPosition.z)) + m_StartingPosition.z; transform.position = new Vector3(x, y, z); m_Easing = false; Kill(); } }
public void Update() { if (!m_Easing || DelayIfNeeded()) { return; } var progress = Easing.ByType(m_EasingType, Time.time - m_StartingTime, 0, 1, m_Duration); if (Time.time - m_StartingTime <= m_Duration) { var scale = (Mathf.Abs(progress) * (m_EndingWidth - m_StartingWidth)) + m_StartingWidth; transform.localScale = new Vector3(scale, scale, scale); } else { progress = 1; var scale = (Mathf.Abs(progress) * (m_EndingWidth - m_StartingWidth)) + m_StartingWidth; transform.localScale = new Vector3(scale, scale, scale); m_Easing = false; Kill(); } }