Пример #1
0
    public bool UseStamina(float staminaAmount, bool forceStaminaUse)
    {
        if (stamina - staminaAmount >= 0 || forceStaminaUse)
        {
            stamina -= staminaAmount;
            StartCoroutine(PauseStaminaRegen());
        }
        else
        {
            Debug.Log("Not enough stamina...");
            return(false);
        }

        if (isPlayer)
        {
            if (stamina < 0)
            {
                stamina = 0;
                playerStaminaStatBar.ChangeBar();
                return(false);
            }
            playerStaminaStatBar.ChangeBar();
        }

        return(true);
    }
Пример #2
0
    public void UseMana(float manaAmount)
    {
        if (mana - manaAmount >= 0)
        {
            mana -= manaAmount;
        }
        else
        {
            Debug.Log("Not enough mana...");
        }

        if (isPlayer)
        {
            playerManaStatBar.ChangeBar();
        }
    }
Пример #3
0
    public void TakeDamage(float damageAmount)
    {
        health -= damageAmount;

        if (isPlayer)
        {
            playerHealthStatBar.ChangeBar();
        }

        if (health <= 0)
        {
            Die();
        }
        else
        {
            audioManager.PlayRandomSound(audioManager.humanMaleGruntSounds, transform.position);
        }
    }