IEnumerator Coroutine_CaptureSequence() { Vector3 lastVelocity = rigidbody.velocity; if (lastVelocity.z < 0) { lastVelocity.z = -lastVelocity.z; } rigidbody.velocity = lastVelocity; lastVelocity *= 0.5f; Vector3 angularVelocity = rigidbody.angularVelocity; yield return(new WaitForSeconds(0.25f)); rigidbody.isKinematic = true; Vector3 eulerAngles = Quaternion.LookRotation(hitPokemon.transform.position - transform.position, Vector3.up).eulerAngles; if (eulerAngles.x > 180) { eulerAngles.x -= 360; } transform.rotation = Quaternion.Euler(Mathf.Lerp(eulerAngles.x, 0, 0.75f), Mathf.Lerp(eulerAngles.y, 180, 0.5f), 0); yield return(new WaitForSeconds(0.15f)); hitPokemon.Capture(pokemonEnterPoint); yield return(new WaitUntil(() => { return !hitPokemon.CanBeCaptured; })); yield return(new WaitForSeconds(0.5f)); rigidbody.isKinematic = false; rigidbody.velocity = lastVelocity; rigidbody.angularVelocity = angularVelocity; isWaitingBeforePokemonCapture = false; }