Exemplo n.º 1
0
 public void StopTurning()
 {
     isTurning = false;
     rot.SetCurrentRotationSpeed(0.0f);
     if (GetComponent <InputManager> () != null)
     {
         GetComponent <InputManager> ().SetInputEnabled(true);
     }
 }
Exemplo n.º 2
0
    void FixedUpdate()
    {
        float turnAxis = Input.GetAxisRaw("Horizontal");

        if (im.GetInputEnabled() && Mathf.Abs(turnAxis) >= 0.2f)
        {
            currentTurnAxis = Mathf.Sign(turnAxis);
            rot.SetCurrentTurnAxis(currentTurnAxis);

            currentRotationSpeed += rotationSpeedIncrement * currentTurnAxis;
            currentRotationSpeed  = Mathf.Min(currentRotationSpeed, maxRotationSpeed);
            currentRotationSpeed  = Mathf.Max(currentRotationSpeed, -maxRotationSpeed);
            rot.SetCurrentRotationSpeed(currentRotationSpeed);

            transform.RotateAround(transform.position, localZAxis, -currentRotationSpeed);
        }
        else if (Mathf.Abs(currentRotationSpeed) >= rotEps)
        {
            currentRotationSpeed = 0.0f;
            rot.SetCurrentRotationSpeed(currentRotationSpeed);

//				transform.RotateAround (transform.position, localZAxis, -currentRotationSpeed);
        }
    }