コード例 #1
0
    void checkInput()
    {
        //isGuarding = Input.GetAxis("Guard") != 0;
        isGuarding = Input.GetAxis("Triggers") > 0;
        bool  heavyAttack = Input.GetAxis("Triggers") < 0;
        float targetFOV   = isGuarding ? cameraFOVRange.x : cameraFOVRange.y;
        float targetRot   = isGuarding ? cameraRotRange.x : cameraRotRange.y;
        float newTheta    = Mathf.Lerp(transform.rotation.eulerAngles.x, targetRot, Time.deltaTime * cameraFOVLerpSpeed);

        mainCamera.fieldOfView             = Mathf.Lerp(mainCamera.fieldOfView, targetFOV, Time.deltaTime * cameraFOVLerpSpeed);
        mainCamera.transform.localRotation = Quaternion.Euler(newTheta, 0, 0);

        if (isStunned)
        {
            return;
        }

        if (action == null && activeCrate != null && (Input.GetButton("Interact") || Input.GetButton("Light Attack") || heavyAttack))
        {
            throwCrate();
            return;
        }
        if (Input.GetButton("Interact") && action == null && Crate.Interact(this))
        {
            return;
        }
        if (ACTION && Input.GetButton("Submit") && isGuarding)
        {
            finishAction();
            startAction("Dash");
            StartCoroutine(dash(dashFactor));
        }

        if (ACTION && Input.GetButton("Light Attack"))
        {
            startAttack("Light Flurry");
            return;
        }

        if (ACTION && heavyAttack && isGuarding || Input.GetButton("Grab"))
        {
            startAttack("Grab");
            return;
        }

        if (ACTION && heavyAttack)
        {
            startAttack("Heavy");
        }

        if (action == "Jump" && heavyAttack)
        {
            startAttack("Jumping Heavy");
        }
        if (action == "Jump" && Input.GetButton("Light Attack"))
        {
            startAttack("Jumping Light");
        }

        if (ACTION && Input.GetButton("Submit") && isGrounded)
        {
            startJump();
        }
        else if (action == "Jump" && jumpFrames.x < jumpFrames.y)
        {
            if ((Input.GetButton("Submit") && continuousJump) || jumpFrames.x < jumpFrames.z)
            {
                continueJump();
            }
            if (!Input.GetButton("Submit"))
            {
                continuousJump = false;
            }
        }
    }