private void Update() { if (m_Type == RotateTypeUI.None) { return; } if (m_Type == RotateTypeUI.Continuous) { m_Transform.Rotate(m_RotateAxis * m_Speed * Time.deltaTime); } if (m_Type == RotateTypeUI.Discreet) { float rate = (Time.time - m_StartTime) / m_Time; m_Angle = Mathf.Lerp(0.0f, m_ToAngle, m_Curve.Evaluate(rate)); m_Transform.rotation = Quaternion.Euler(m_RotateAxis * m_Angle); if (m_Angle >= m_ToAngle) { m_Type = RotateTypeUI.None; m_Transform.rotation = Quaternion.identity; } } }
public void Rotate() { m_StartTime = Time.time; m_Type = RotateTypeUI.Discreet; }
private void Start() { m_Type = m_UseContinuous ? RotateTypeUI.Continuous : RotateTypeUI.None; }