Exemple #1
0
    /// <summary>
    /// Apply a Damage Over Time effect to the target
    /// </summary>
    /// <param name="target">target GameObject.</param>
    /// <param name="lengthTime">length time.</param>
    /// <param name="tickTime">tick time.</param>
    /// <param name="dmgPerTick">damage per tick.</param>
    /// <param name="cause">source of the damage (burn, bleed, etc).</param>
    public void dmgApplyingSystem(GameObject target, float lengthTime, float tickTime, int dmgPerTick, BuffsAndBoons.Effects cause)
    {
        DamageOverTime dot = null;

        DamageOverTime[] allDoTs;
        allDoTs = target.GetComponents <DamageOverTime>();

        foreach (DamageOverTime existingDoT in allDoTs)
        {
            if (existingDoT.getCause() == cause)
            {
                dot = existingDoT;
            }
        }

        if (dot == null)
        {
            dot = target.AddComponent <DamageOverTime>();
            dot.setCause(cause);
        }
        else
        {
            dot.stopDoT();
        }

        // A tenth of a second is added to the duration to ensure the last bit of a damage tick
        // can go off. If the last tick goes off as the DoT destroys itself, it doesn't seem
        // to apply.
        dot.setDuration(lengthTime + 0.1f);
        dot.setTickCooldown(tickTime);
        dot.setDamagePerTick(dmgPerTick);

        dot.startDoT();
    }
Exemple #2
0
 public void setCause(BuffsAndBoons.Effects theCause)
 {
     cause = theCause;
 }