public bool AddHealingModifier(HealingModifier modifier, int priority = 0) { if (modifier == null || _healingModifiers.Contains(modifier)) return false; _healingModifiers.Add(modifier); return true; }
/// <summary> /// Apply healing to the Health. If health value has reached zero, will not work unless allowRevival is true. /// </summary> /// <param name="amount">The amount of healing.</param> /// <returns>The actual healing amount applied.</returns> public virtual float Heal(float amount) { if (enabled && (!dead || allowRevival) && amount > 0) { HealingModifier?.Invoke(ref amount); float prevHealth = health; health += amount; health = Mathf.Min(health, maxHealth); amount = health - prevHealth; SendMessage("OnHeal", amount, SendMessageOptions.DontRequireReceiver); Healed?.Invoke(amount); if (dead) { dead = false; SendMessage("OnRevive", SendMessageOptions.DontRequireReceiver); Revived?.Invoke(); } } else { amount = 0; } return(amount); }
/// <inheritdoc /> public CombatAttribute Convert(AttributeDTO value, object state) { var entity = new HealingModifier(); this.Merge(entity, value, state); return(entity); }
public bool AddHealingModifier(HealingModifier modifier, int priority = 0) { if (modifier == null || _healingModifiers.Contains(modifier)) { return(false); } _healingModifiers.Add(modifier); return(true); }
public bool RemoveHealingModifier(HealingModifier modifier) { return _healingModifiers.Remove(modifier); }
// Implement this method in a buddy class to set properties that are specific to 'HealingModifier' (if any) partial void Merge(HealingModifier entity, AttributeDTO dto, object state);
public bool RemoveHealingModifier(HealingModifier modifier) { return(_healingModifiers.Remove(modifier)); }