コード例 #1
0
    void ReadInputs()
    {
        if (input.meleeAttackInput && !isMeleeAttack && isGrounded && playerStats.HasStamina(meleeCost))
        {
            isMeleeAttack = true;
            playerStats.RecieveStamina(meleeCost);
        }

        if (isMeleeAttack)
        {
            meleeCollScript.SetDamage(meleeDamage);
        }
        else
        {
            meleeCollScript.SetDamage(0);
        }

        if (input.runInput && playerStats.HasStamina(runCost + 5))
        {
            isRunning = true;
        }
        else
        {
            isRunning = false;
        }

        if (input.dodgeInput && !isDodge && isGrounded && !isMeleeAttack)
        {
            if (playerStats.HasStamina(dodgeCost))
            {
                isDodge = true;
                playerStats.RecieveStamina(dodgeCost);
                anim.SetTrigger("Dodge");
            }
        }

        if (input.camModeInput)
        {
            lockTarget = !lockTarget;
        }

        camForward = Vector3.Scale(cam.forward, new Vector3(1, 0, 1)).normalized;
        camSide    = Vector3.Scale(cam.right, new Vector3(1, 0, 1)).normalized;
        move       = input.vertical * camForward + input.horizontal * cam.right;

        godMode = input.godMode;
    }