Esempio n. 1
0
    private void OnRB()
    {
        if (inventoryFlag)
        {
            return;
        }

        if (playerInventory.isFireWeaponEquiped)
        {
            playerInventory.EquipCurrentWeapon();
        }

        if (playerManager.canDoCombo)
        {
            comboFlag = true;
            rodySoundsManager.prepararSonido(3);
            playerAttacker.HandleWeaponCombo(playerInventory.rightWeapon);
            comboFlag = false;
        }
        else
        {
            if (playerManager.isInteracting)
            {
                return;
            }

            if (playerManager.canDoCombo)
            {
                return;
            }
            rodySoundsManager.prepararSonido(3);
            playerAttacker.HandleLightAttack(playerInventory.rightWeapon);
        }
    }
Esempio n. 2
0
    private void HandleAttackInput(float delta) //attack stuff
    {
        left_click = inputActions.PlayerActions.LeftClick.phase == UnityEngine.InputSystem.InputActionPhase.Started;

        if (left_click)
        {
            clickTimer += delta;
        }
        if (clickTimer > 0 && clickTimer < 0.5f && left_click == false)
        {
            int lightAttackStaminaMinimum = Mathf.RoundToInt(playerInventory.leftWeapon.baseStamina * playerInventory.leftWeapon.lightAttackMultiplier);
            clickTimer = 0;

            if (playerStats.currentStamina >= lightAttackStaminaMinimum)
            {
                if (playerManager.canDoCombo)
                {
                    animatorHandler.anim.SetBool("isUsingLeftHand", true);
                    comboFlag = true;
                    playerAttacker.HandleWeaponCombo(playerInventory.leftWeapon);
                    comboFlag = false;
                }
                else
                {
                    if (playerManager.isInteracting)
                    {
                        return;
                    }

                    if (playerManager.canDoCombo)
                    {
                        return;
                    }

                    animatorHandler.anim.SetBool("isUsingLeftHand", true);
                    playerAttacker.HandleLightMeleeAttack(playerInventory.leftWeapon);
                }
            }
            else
            {
                Debug.Log("Out of stamina");
            }
        }
        else if (clickTimer > 0.5f && left_click == false)
        {
            int heavyAttackStaminaMinimum = Mathf.RoundToInt(playerInventory.leftWeapon.baseStamina * playerInventory.leftWeapon.heavyAttackMultiplier);
            clickTimer = 0;

            if (playerStats.currentStamina >= heavyAttackStaminaMinimum)
            {
                animatorHandler.anim.SetBool("isUsingLeftHand", true);
                playerAttacker.HandleHeavyMeleeAttack(playerInventory.leftWeapon);
            }
            else
            {
                Debug.Log("Out of stamina");
            }
        }

        if (right_click)
        {
            playerAttacker.HandleRangeAttack();
            //animatorHandler.anim.SetBool("isUsingRightHand", true);
        }
    }