rotateCharacter() public method

public rotateCharacter ( float direction ) : void
direction float
return void
Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        float mouseX = Input.GetAxis("Mouse X");
        float mouseY = Input.GetAxis("Mouse Y");

        if (Mathf.Abs(mouseX) > float.Epsilon || Mathf.Abs(mouseY) > float.Epsilon)
        {
            mouseLook.rotateView(mouseX, mouseY);
        }
        if (Input.GetKey(KeyCode.Q))
        {
            rotator.rotateCharacter(rotationSpeed);
        }
        if (Input.GetKey(KeyCode.E))
        {
            rotator.rotateCharacter(-rotationSpeed);
        }

        if (!grappleGun)
        {
            return;
        }

        debounce -= Time.deltaTime;
        if (debounce < 0)
        {
            debounce = 0;
        }

        if (Input.GetButtonDown("Fire2") && !justFired && debounce == 0)
        {
            grappleGun.fire();
            if (isAttachedToSurface)
            {
                Debug.Log("Detached from surface");
                isAttachedToSurface = false;
                sMovement.detachFromSurface();
            }

            debounce  = debounceTime;
            justFired = true;
        }

        if (Input.GetButtonDown("Fire2") && justFired && debounce == 0)
        {
            grappleGun.detach();
            debounce  = debounceTime;
            justFired = false;
        }

        if (Input.GetButtonDown("Jump") && grappled)
        {
            grappleGun.reelIn();
        }
    }