Ejemplo n.º 1
0
    IEnumerator DamageOverTimeCo(float damageAmount, float duration, float tickRate, StatusEffectManager.CurrentStatus status)
    {
        float amountDamaged = 0;
        float damagePerTick = damageAmount / duration;

        switch (status)
        {
        case StatusEffectManager.CurrentStatus.Poison:
            ui.SetMaxPoison(damageAmount);
            break;

        case StatusEffectManager.CurrentStatus.Bleed:
            ui.SetMaxBleed(damageAmount);
            break;

        case StatusEffectManager.CurrentStatus.Burn:
            ui.SetMaxBurn(damageAmount);
            break;
        }

        while (amountDamaged < damageAmount)
        {
            currentHealth -= (int)damagePerTick;
            amountDamaged += damagePerTick;
            switch (status)
            {
            case StatusEffectManager.CurrentStatus.Poison:
                ui.SetPoison(damageAmount - amountDamaged);
                break;

            case StatusEffectManager.CurrentStatus.Bleed:
                ui.SetBleed(damageAmount - amountDamaged);
                break;

            case StatusEffectManager.CurrentStatus.Burn:
                ui.SetBurn(damageAmount - amountDamaged);
                break;
            }
            yield return(new WaitForSeconds(tickRate));
        }
    }
Ejemplo n.º 2
0
 //==========================================================================STATUS EFFECTS========================================================================
 public void DamageOverTime(int damageAmount, int duration, float tickRate, StatusEffectManager.CurrentStatus status)
 {
     StartCoroutine(DamageOverTimeCo(damageAmount, duration, tickRate, status));
 }