Beispiel #1
0
    void HandleHealing()
    {
        if (isCurrentlyHealing)
        {
            timeLeftToHeal -= Time.deltaTime;
        }

        if (Input.GetKey(KeyCode.Alpha8))
        {
            healUsing = healthType.bandage; UseHealItem(healUsing);
        }
        if (Input.GetKey(KeyCode.Alpha9))
        {
            healUsing = healthType.stimPack; UseHealItem(healUsing);
        }
        if (Input.GetKey(KeyCode.Alpha0))
        {
            healUsing = healthType.royalJelly; UseHealItem(healUsing);
        }

        if (isCurrentlyHealing && timeLeftToHeal <= 0)
        {
            Heal(healUsing);
            isCurrentlyHealing = false;
        }
    }
Beispiel #2
0
    void Heal(healthType healer)
    {
        switch (healer)
        {
        case healthType.royalJelly: currentHealth += royalJellyHealAmount; inv.royalJellies -= 1; break;

        case healthType.stimPack: currentHealth += stimPackHealAmount; inv.stimPacks -= 1; break;

        case healthType.bandage: currentHealth += bandageHealAmount; inv.bandages -= 1;  break;

        default: break;
        }
        isCurrentlyHealing = false;
        if (currentHealth > maxHealth)
        {
            currentHealth = maxHealth;
        }
    }
Beispiel #3
0
    public void UseHealItem(healthType healer)
    {
        if (!isCurrentlyHealing)
        {
            switch (healer)
            {
            case healthType.royalJelly:
            {
                if (inv.royalJellies > 0)
                {
                    timeLeftToHeal     = royalJellyTime;
                    isCurrentlyHealing = true;
                }
                break;
            }

            case healthType.stimPack:
            {
                if (inv.stimPacks > 0)
                {
                    timeLeftToHeal     = stimPackTime;
                    isCurrentlyHealing = true;
                }
                break;
            }

            case healthType.bandage:
            {
                if (inv.bandages > 0)
                {
                    timeLeftToHeal     = bandageTime;
                    isCurrentlyHealing = true;
                }
                break;
            }

            default: break;
            }
        }
    }