public IEnumerator OpenDoorAnimation() { m_CurrentT = 0.0f; while (m_CurrentT < m_MaxT) { float t = Mathf.Clamp(m_CurrentT / m_MaxT, 0.0f, 1.0f); if (t >= 0.9f) { m_Light.enabled = true; } m_CurrentT += Time.deltaTime; t = EasingFunctions.OutElastic(t); m_Door.localRotation = Quaternion.Slerp(m_ClosedDoorRotation, m_OpenDoorRotation, t); Debug.Log(m_Door.rotation); yield return(new WaitForEndOfFrame()); } }