Ejemplo n.º 1
0
    public void Rotate()
    {
        Vector3 rotation_Direction = Vector3.zero;

        if (Input.GetAxis(Axis.HORIZONTAL_AXIS) < 0)
        {
            TournerGauche();
        }
        else
        {
            playerAnimations.TurnLeft(false);
        }

        if (Input.GetAxis(Axis.HORIZONTAL_AXIS) > 0)
        {
            TournerDroite();
        }
        else
        {
            playerAnimations.TurnRight(false);
        }

        if (rotation_Direction != Vector3.zero)
        {
            transform.rotation = Quaternion.RotateTowards(
                transform.rotation, Quaternion.LookRotation(rotation_Direction),
                rotateDegreesPerSecond * Time.deltaTime);
        }
    }//rotate