private float ApplyRegenModel(float baseRegenRate, float modifier)
        {
            float regenRate     = baseRegenRate * modifier;
            float regenTime     = healthLimit / regenRate;
            float origRegenTime = Agent.HealthLimit / regenRate;

            try
            {
                var data = new RegenDataInfo(Agent, healthLimit, regenRate, regenTime, origRegenTime);
                regenRate = settings.RegenModel.Calculate(ref data);
            }
            catch (Exception e)
            {
                behavior.messages.Enqueue($"[BattleRegeneration] An exception has occurred attempting to calculate regen value for {Agent.Name}. Using linear instead.\nException: {e}");
            }

            return(regenRate);
        }
Пример #2
0
 /// <summary>
 /// Performs calculation with this formula, given regeneration data, and returns a value. Subclasses should provide their own implementation of this method,
 /// for this method returns zero by default. All parameters are passed by reference.
 /// </summary>
 /// <param name="data">The regeneration data information. See <see cref="RegenDataInfo"/>.</param>
 /// <returns>The modified regeneration rate.</returns>
 public abstract float Calculate(ref RegenDataInfo data);