Ejemplo n.º 1
0
 public void StartRotate(float increase, Wise wise, Finish handler)
 {
     if (!isRotating)
     {
         this.StartCoroutine(Rotate(increase, wise, handler));
     }
 }
Ejemplo n.º 2
0
    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);
    }