Class AutoGoalInfo
A GoalInfo for an auto-triggered goal, specifically a AmountGoal, ConditionedGoal or DistinctGoal<T>. To construct a new auto goal info, use the provided static methods in this class.
public class AutoGoalInfo : GoalInfo, IGenericDataHolder
- Inheritance
-
GenericDataHolderAutoGoalInfo
- Implements
-
IGenericDataHolder
- Inherited Members
-
GenericDataHolder.GetDataKeys()
- Extension Methods
Constructors
AutoGoalInfo(string, GoalTrigger[], Func<object, bool>, Func<GoalSet, AutoGoalInfo, Goal>)
Creates a new auto goal info with the given settings. To create a new auto goal info of an API-provided type, use any of the static methods in this class.
protected AutoGoalInfo(string name, GoalTrigger[] triggers, Func<object, bool> condition, Func<GoalSet, AutoGoalInfo, Goal> constructor)
Parameters
namestringThe name of the goal
triggersGoalTrigger[]A set of GoalTrigger instances which represents the triggers that this goal should react to
conditionFunc<object, bool>A condition that determines whether the goal should be triggered or advanced
constructorFunc<GoalSet, AutoGoalInfo, Goal>The function that should be called to construct a goal instance
Fields
Condition
A condition, which takes in an object and returns whether this auto goal can be triggered. This value is used in Trigger(IGoalTriggerable, object, GoalTrigger, object[]).
public readonly Func<object, bool> Condition
Field Value
Triggers
A set of GoalTrigger instances that trigger this auto goal. This value is used in Trigger(IGoalTriggerable, object, GoalTrigger, object[]).
public readonly GoalTrigger[] Triggers
Field Value
Methods
Amount<T>(string, float, Func<T, bool>, params GoalTrigger[])
Creates a new amount-based auto goal info which will construct an AmountGoal
Check GoalTrigger documentation to see if the given triggers are compatible with the type parameter T and this type of goal.
public static AutoGoalInfo Amount<T>(string name, float goalAmount, Func<T, bool> condition = null, params GoalTrigger[] triggers)
Parameters
namestringThe name of the goal
goalAmountfloatThe total amount that needs to be reached until this goal is completed
conditionFunc<T, bool>A condition that determines whether the goal should be triggered or advanced
triggersGoalTrigger[]A set of GoalTrigger instances which represents the triggers that this goal should react to
Returns
- AutoGoalInfo
An auto goal info with the given settings
Type Parameters
TThe type of object that this goal is related to. See the documentation for the chosen
triggersfor compatibility between goal objects and goal triggers
Conditioned<T>(string, Func<T, bool>, params GoalTrigger[])
Creates a new auto goal info which will construct a ConditionedGoal.
Check GoalTrigger documentation to see if the given triggers are compatible with the type parameter T and this type of goal.
public static AutoGoalInfo Conditioned<T>(string name, Func<T, bool> condition = null, params GoalTrigger[] triggers)
Parameters
namestringThe name of the goal
conditionFunc<T, bool>A condition that determines whether the goal should be triggered or advanced
triggersGoalTrigger[]A set of GoalTrigger instances which represents the triggers that this goal should react to
Returns
- AutoGoalInfo
An auto goal info with the given settings
Type Parameters
TThe type of object that this goal is related to. See the documentation for the chosen
triggersfor compatibility between goal objects and goal triggers
Distinct<T>(string, IEnumerable<string>, Func<T, string>, Func<T, bool>, params GoalTrigger[])
Creates a new auto goal info which will construct a DistinctGoal<T>.
This method creates a distinct goal that requires a set of distinctly named objects and that is completed when the set of objects matches the goalItems exactly.
Check GoalTrigger documentation to see if the given triggers are compatible with the type parameter T and this type of goal.
public static AutoGoalInfo Distinct<T>(string name, IEnumerable<string> goalItems, Func<T, string> goalItemNameSelector, Func<T, bool> condition = null, params GoalTrigger[] triggers)
Parameters
namestringThe name of the goal
goalItemsIEnumerable<string>A set of items that this goal has to be triggered for for the goal to be completed
goalItemNameSelectorFunc<T, string>A function that determines the distinct name of an object that this goal has been triggered for
conditionFunc<T, bool>A condition that determines whether the goal should be triggered or advanced
triggersGoalTrigger[]A set of GoalTrigger instances which represents the triggers that this goal should react to
Returns
- AutoGoalInfo
An auto goal info with the given settings
Type Parameters
TThe type of object that this goal is related to. See the documentation for the chosen
triggersfor compatibility between goal objects and goal triggers
Distinct<T>(string, int, Func<T, string>, Func<T, bool>, params GoalTrigger[])
Creates a new auto goal info which will construct a DistinctGoal<T>.
This method creates a distinct goal that requires a set of distinctly named objects and that is completed when the goalItemAmount is reached.
Check GoalTrigger documentation to see if the given triggers are compatible with the type parameter T and this type of goal.
public static AutoGoalInfo Distinct<T>(string name, int goalItemAmount, Func<T, string> goalItemNameSelector, Func<T, bool> condition = null, params GoalTrigger[] triggers)
Parameters
namestringThe name of the goal
goalItemAmountintThe amount of distinct items that need to be triggered for this goal to be completed
goalItemNameSelectorFunc<T, string>A function that determines the distinct name of an object that this goal has been triggered for
conditionFunc<T, bool>A condition that determines whether the goal should be triggered or advanced
triggersGoalTrigger[]A set of GoalTrigger instances which represents the triggers that this goal should react to
Returns
- AutoGoalInfo
An auto goal info with the given settings
Type Parameters
TThe type of object that this goal is related to. See the documentation for the chosen
triggersfor compatibility between goal objects and goal triggers
Timed<T>(string, TimeSpan, Func<T, bool>, params GoalTrigger[])
Creates a new timed auto goal info which will construct a TimedGoal
Check GoalTrigger documentation to see if the given triggers are compatible with the type parameter T and this type of goal.
public static AutoGoalInfo Timed<T>(string name, TimeSpan goalTime, Func<T, bool> condition = null, params GoalTrigger[] triggers)
Parameters
namestringThe name of the goal
goalTimeTimeSpanThe total time until this goal is considered completed
conditionFunc<T, bool>A condition that determines whether the goal should be triggered or advanced
triggersGoalTrigger[]A set of GoalTrigger instances which represents the triggers that this goal should react to
Returns
- AutoGoalInfo
An auto goal info with the given settings
Type Parameters
TThe type of object that this goal is related to. See the documentation for the chosen
triggersfor compatibility between goal objects and goal triggers