Table of Contents

Class AutoGoalInfo

Namespace
TinyLife.Goals
Assembly
Tiny Life.dll

A GoalInfo for an auto-triggered goal, specifically a AmountGoal, ConditionedGoal or DistinctGoal. To construct a new auto goal info, use the provided static methods in this class.

public class AutoGoalInfo : GoalInfo, IGenericDataHolder
Inheritance
GenericDataHolder
AutoGoalInfo
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

name string

The name of the goal

triggers GoalTrigger[]

A set of GoalTrigger instances which represents the triggers that this goal should react to

condition Func<object, bool>

A condition that determines whether the goal should be triggered or advanced

constructor Func<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, params object[]).

public readonly Func<object, bool> Condition

Field Value

Func<object, bool>

Triggers

A set of GoalTrigger instances that trigger this auto goal. This value is used in Trigger(IGoalTriggerable, object, GoalTrigger, params object[]).

public readonly GoalTrigger[] Triggers

Field Value

GoalTrigger[]

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

name string

The name of the goal

goalAmount float

The total amount that needs to be reached until this goal is completed

condition Func<T, bool>

A condition that determines whether the goal should be triggered or advanced

triggers GoalTrigger[]

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

T

The type of object that this goal is related to. See the documentation for the chosen triggers for 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

name string

The name of the goal

condition Func<T, bool>

A condition that determines whether the goal should be triggered or advanced

triggers GoalTrigger[]

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

T

The type of object that this goal is related to. See the documentation for the chosen triggers for 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

name string

The name of the goal

goalItems IEnumerable<string>

A set of items that this goal has to be triggered for for the goal to be completed

goalItemNameSelector Func<T, string>

A function that determines the distinct name of an object that this goal has been triggered for

condition Func<T, bool>

A condition that determines whether the goal should be triggered or advanced

triggers GoalTrigger[]

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

T

The type of object that this goal is related to. See the documentation for the chosen triggers for 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. 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

name string

The name of the goal

goalItemAmount int

The amount of distinct items that need to be triggered for this goal to be completed

goalItemNameSelector Func<T, string>

A function that determines the distinct name of an object that this goal has been triggered for

condition Func<T, bool>

A condition that determines whether the goal should be triggered or advanced

triggers GoalTrigger[]

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

T

The type of object that this goal is related to. See the documentation for the chosen triggers for 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

name string

The name of the goal

goalTime TimeSpan

The total time until this goal is considered completed

condition Func<T, bool>

A condition that determines whether the goal should be triggered or advanced

triggers GoalTrigger[]

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

T

The type of object that this goal is related to. See the documentation for the chosen triggers for compatibility between goal objects and goal triggers