public void StartRotate(float increase, Wise wise, Finish handler) { if (!isRotating) { this.StartCoroutine(Rotate(increase, wise, handler)); } }
public IEnumerator Rotate(float increase, Wise wise, Finish handler) { isRotating = true; increase -= 1f; Vector2 dir = wise == Wise.Clockwise ? Vector2.up : Vector2.down; while (increase > Target.rotation.eulerAngles.y) { float angularLerp = Mathf.Lerp(AngularSpeed, 0, Time.deltaTime * 0.2f); transform.RotateAround(Target.position, dir, AngularSpeed); increase -= AngularSpeed; yield return(new WaitForFixedUpdate()); } isRotating = false; handler(transform); }