QA_AttributeHandler

Handles any attributes a character has, including decaying and removing them.

public QA_AttributeDatabase AttributeDatabase The reference to the database containing all of the possible character attributes.
public QA_AttributeModifierDatabase ModifierDatabase The reference to the database containing all of the possible character attribute modifiers.
public List<QA_Attribute> Attributes The list of attributes this character uses.

Gets an attribute by name.

string name The name of the attribute.
QA_Attribute attribute = attributeHandler.GetAttribute("Strength");

Gets an attribute value by name.

string name The name of the attribute.
float strength = attributeHandler.GetAttributeValue("Strength");

Sets an attribute value by name.

string name The name of the attribute.
float value The new value of the attribute.
attributeHandler.SetAttributeValue("Strength", 5);

Adds a new attribute to the list from the handler's attribute database.

string name The name of the attribute.
float value The value of the attribute.
attributeHandler.AddAttribute("Strength", 5);

Removes an attribute from the handler.

string name The name of the attribute.
attributeHandler.RemoveAttribute("Strength");

Adds a modifier to an attribute.

string attributeName The name of the attribute.
string modifierName The name of the modifier.
attributeHandler.AddModifier("Strength", "Strength Buff");

Removes a modifier from an attribute.

string attributeName The name of the attribute.
string modifierName The name of the modifier.
attributeHandler.RemoveModifier("Strength", "Strength Buff");

QA_Attribute

Represents a character attribute, such as strength, agility, etc. It can also be used to represent health, mana, etc.

public string Name The name of the attribute.
public float MinimumValue The minimum value the attribute can have.
public float MaximumValue The maximum value the attribute can have.
public float Value The current value of the attribute.
public List<QA_AttributeModifier> PermanentModifiers The list of permanent modifiers affecting the attribute. This shouldn't be manually changed, call the AddModifier function.
public List<QA_AttributeModifier> TemporaryModifiers The list of temporary modifiers affecting the attribute. This shouldn't be manually changed, call the AddModifier function.

Sets and clamps the value of the attribute.

float value The new value.
attribute.SetValue(5);

Applies each of the temporary modifiers to the attribute. This should be done an update function. You shouldn't need to use this function, as it's called in the AttributeHandler.

float deltaTime Time.deltaTime or an equivalent, such as fixedTime for FixedUpdate.
attribute.ApplyTemporaryModifiers(Time.deltaTime);

Decays each of the modifiers by the given amount. You shouldn't need to use this function, as it's called in the AttributeHandler.

float amount How much to decay by.
attribute.DecayModifiers(Time.deltaTime);

Adds a modifier to the handler from the given template.

QA_AttributeModifier template The template modifier.
attribute.AddModifier(modifier);

Removes a modifier from the handler.

string name The name of the modifier.
QA_AMDuration duration The duration of the modifier, used to remove the modifier from the right list.
attribute.RemoveModifier("Strength Buff", QA_AMDuration.Permanent);

QA_AttributeModifier

Represents a modification to a character attribute, such as a permanent strength buff, a temporary poison that decreases health, etc.

public string Name The name of the modifier.
public QA_AMModificationType ModificationType How the modifier will change the attribute, either by a certain amount or percentage.
public float Value The value of the modifier, such as 1 (raw number or %).
public QA_AMDuration Duration The duration of the modifier, either permanent (until manually removed), or temporary (after a certain number of seconds or frames).
public float Lifetime How long the modifier (if temporary) will last, in either seconds or frames.
public float ModificationInterval The time in frames or seconds (if temporary) between changing the attribute's value. If this is zero, then the attribute won't periodically change.

Stores a list of attribute templates for characters to use. This doesn't need to be used, except by the attribute.

float amount How much to decay the modifier.
modifier.Decay(Time.deltaTime);

QA_AttributeDatabase

Stores a list of attribute modifier templates for characters to use.

public List<QA_Attribute> Attributes The list of attributes in the database.

Gets an attribute by name.

string name The name of the attribute.
attributeDatabase.GetAttribute("Strength");

QA_AttributeModifierDatabase

Handles character level and experience.

public List<QA_AttributeModifier> Modifiers The list of attribute modifiers in the database.

Gets a modifier by name.

string name The name of the modifier.
modifierDatabse.GetModifier("Strength Buff");

QA_ExperienceHandler

Handles character level and experience.

public int Level The character's level.
public int MaxLevel The highest level a character can be.
public float XP The character's current xp.
public float MaxXP The character's current maximum xp.
public float MaxXPIncrease How much the max xp will change by when leveling up, either as a raw amount or a percentage.
public QA_ExperienceType XPType How the XP changes when leveling up, either excess carrying over or excess being removed.
public QA_ExperienceMaxType MaxXPType Whether the max xp when leveling up increase by a set amount or a percentage.

Adds XP to the handler and returns if it leveled up.

float amount How much XP to add.
xpHandler.AddXP(20);