/// <summary> /// Adds a modifier to an attribute. /// </summary> /// <param name="attributeName">The name of the attribute.</param> /// <param name="modifierName">The name of the modifier.</param> public void AddModifier(string attributeName, string modifierName) { QA_Attribute attribute = GetAttribute(attributeName); if (attribute == null) { return; } attribute.AddModifier(ModifierDatabase.GetModifier(modifierName)); }
/// <summary> /// Removes a modifier from an attribute. /// </summary> /// <param name="attributeName">The name of the attribute.</param> /// <param name="modifierName">The name of the modifier.</param> public void RemoveModifier(string attributeName, string modifierName) { QA_Attribute attribute = GetAttribute(attributeName); if (attribute == null) { return; } attribute.RemoveModifier(modifierName, ModifierDatabase.GetModifier(modifierName).Duration); }
/// <summary> /// Adds a new attribute to the list from the handler's attribute database. /// </summary> /// <param name="name">The name of the attribute.</param> /// <param name="value">The value of the attribute.</param> public void AddAttribute(string name, float value = 0) { foreach (var attribute in Attributes) { if (attribute.Name == name) { return; } } QA_Attribute newAttribute = new QA_Attribute(AttributeDatabase.GetAttribute(name)); newAttribute.SetValue(value); if (newAttribute != null) { Attributes.Add(newAttribute); } }
public QA_Attribute(QA_Attribute template) { Name = template.Name; MinimumValue = template.MinimumValue; MaximumValue = template.MaximumValue; Value = template.Value; PermanentModifiers = new List <QA_AttributeModifier>(template.PermanentModifiers); TemporaryModifiers = new List <QA_AttributeModifier>(template.TemporaryModifiers); foreach (var modifier in template.PermanentModifiers) { PermanentModifiers.Add(new QA_AttributeModifier(modifier)); } foreach (var modifier in template.TemporaryModifiers) { TemporaryModifiers.Add(new QA_AttributeModifier(modifier)); } }