Table of Contents

Interface IGoalTriggerable

Namespace
TinyLife.Goals
Assembly
Tiny Life.dll

An interface that classes like GoalSet implement to allow for them or their AutoTriggerGoal instances to be triggered by a GoalTrigger that is associated with an object and a value.

public interface IGoalTriggerable
Extension Methods

Methods

Trigger(IEnumerable<IGoalTriggerable>, object, GoalTrigger, params object[])

Triggers all auto-triggered goals with the specified type constraint in the given set of GoalSet instances. When calling this method, it should ideally be called on a specific subclass like AmountGoal, ConditionedGoal or DistinctGoal. When calling this method for a PersonLike, their GetCurrentGoals() should be used.

public static bool Trigger(IEnumerable<IGoalTriggerable> sets, object obj, GoalTrigger trigger, params object[] values)

Parameters

sets IEnumerable<IGoalTriggerable>

The set of goal set instances to search for auto-triggered goals

obj object

The object that triggered the given trigger.

trigger GoalTrigger

The goal trigger that is triggering this IGoalTriggerable.

values object[]

The values that is associated with the trigger, which is usually an amount that a value has changed by, an amount of money, or similar. The values will be passed individually to TryTrigger(object, GoalTrigger, object).

Returns

bool

Whether any goal was successfully triggered.

Trigger(IGoalTriggerable, object, GoalTrigger, params object[])

Triggers all auto-triggered goals with the specified type constraint in the given GoalSet. When calling this method, it should ideally be called on a specific subclass like AmountGoal, ConditionedGoal or DistinctGoal. When calling this method for a PersonLike, their GetCurrentGoals() should be used.

public static bool Trigger(IGoalTriggerable set, object obj, GoalTrigger trigger, params object[] values)

Parameters

set IGoalTriggerable

The goal set to search for auto-triggered goals

obj object

The object that triggered the given trigger.

trigger GoalTrigger

The goal trigger that is triggering this IGoalTriggerable.

values object[]

The values that is associated with the trigger, which is usually an amount that a value has changed by, an amount of money, or similar. The values will be passed individually to TryTrigger(object, GoalTrigger, object).

Returns

bool

Whether any goal was successfully triggered.

Trigger<TObject, TValue>(IEnumerable<IGoalTriggerable>, TObject, GoalTrigger<TObject, TValue>, TValue)

Triggers all auto-triggered goals with the specified type constraint in the given set of GoalSet instances. When calling this method, it should ideally be called on a specific subclass like AmountGoal, ConditionedGoal or DistinctGoal. When calling this method for a PersonLike, their GetCurrentGoals() should be used.

public static bool Trigger<TObject, TValue>(IEnumerable<IGoalTriggerable> sets, TObject obj, GoalTrigger<TObject, TValue> trigger, TValue value)

Parameters

sets IEnumerable<IGoalTriggerable>

The set of goal set instances to search for auto-triggered goals

obj TObject

The object that triggered the given trigger.

trigger GoalTrigger<TObject, TValue>

The goal trigger that is triggering this IGoalTriggerable.

value TValue

Returns

bool

Whether any goal was successfully triggered.

Type Parameters

TObject
TValue

Trigger<TObject, TValue>(IGoalTriggerable, TObject, GoalTrigger<TObject, TValue>, TValue)

Triggers all auto-triggered goals with the specified type constraint in the given GoalSet. When calling this method, it should ideally be called on a specific subclass like AmountGoal, ConditionedGoal or DistinctGoal. When calling this method for a PersonLike, their GetCurrentGoals() should be used.

public static bool Trigger<TObject, TValue>(IGoalTriggerable set, TObject obj, GoalTrigger<TObject, TValue> trigger, TValue value)

Parameters

set IGoalTriggerable

The goal set to search for auto-triggered goals

obj TObject

The object that triggered the given trigger.

trigger GoalTrigger<TObject, TValue>

The goal trigger that is triggering this IGoalTriggerable.

value TValue

Returns

bool

Whether any goal was successfully triggered.

Type Parameters

TObject
TValue

Trigger<TObject, TValue1, TValue2>(IEnumerable<IGoalTriggerable>, TObject, GoalTrigger<TObject, TValue1, TValue2>, TValue1, TValue2)

Triggers all auto-triggered goals with the specified type constraint in the given set of GoalSet instances. When calling this method, it should ideally be called on a specific subclass like AmountGoal, ConditionedGoal or DistinctGoal. When calling this method for a PersonLike, their GetCurrentGoals() should be used.

public static bool Trigger<TObject, TValue1, TValue2>(IEnumerable<IGoalTriggerable> sets, TObject obj, GoalTrigger<TObject, TValue1, TValue2> trigger, TValue1 value1, TValue2 value2)

Parameters

sets IEnumerable<IGoalTriggerable>

The set of goal set instances to search for auto-triggered goals

obj TObject

The object that triggered the given trigger.

trigger GoalTrigger<TObject, TValue1, TValue2>

The goal trigger that is triggering this IGoalTriggerable.

value1 TValue1
value2 TValue2

Returns

bool

Whether any goal was successfully triggered.

Type Parameters

TObject
TValue1
TValue2

Trigger<TObject, TValue1, TValue2>(IGoalTriggerable, TObject, GoalTrigger<TObject, TValue1, TValue2>, TValue1, TValue2)

Triggers all auto-triggered goals with the specified type constraint in the given GoalSet. When calling this method, it should ideally be called on a specific subclass like AmountGoal, ConditionedGoal or DistinctGoal. When calling this method for a PersonLike, their GetCurrentGoals() should be used.

public static bool Trigger<TObject, TValue1, TValue2>(IGoalTriggerable set, TObject obj, GoalTrigger<TObject, TValue1, TValue2> trigger, TValue1 value1, TValue2 value2)

Parameters

set IGoalTriggerable

The goal set to search for auto-triggered goals

obj TObject

The object that triggered the given trigger.

trigger GoalTrigger<TObject, TValue1, TValue2>

The goal trigger that is triggering this IGoalTriggerable.

value1 TValue1
value2 TValue2

Returns

bool

Whether any goal was successfully triggered.

Type Parameters

TObject
TValue1
TValue2

Trigger<TObject, TValue1, TValue2, TValue3>(IEnumerable<IGoalTriggerable>, TObject, GoalTrigger<TObject, TValue1, TValue2, TValue3>, TValue1, TValue2, TValue3)

Triggers all auto-triggered goals with the specified type constraint in the given set of GoalSet instances. When calling this method, it should ideally be called on a specific subclass like AmountGoal, ConditionedGoal or DistinctGoal. When calling this method for a PersonLike, their GetCurrentGoals() should be used.

public static bool Trigger<TObject, TValue1, TValue2, TValue3>(IEnumerable<IGoalTriggerable> sets, TObject obj, GoalTrigger<TObject, TValue1, TValue2, TValue3> trigger, TValue1 value1, TValue2 value2, TValue3 value3)

Parameters

sets IEnumerable<IGoalTriggerable>

The set of goal set instances to search for auto-triggered goals

obj TObject

The object that triggered the given trigger.

trigger GoalTrigger<TObject, TValue1, TValue2, TValue3>

The goal trigger that is triggering this IGoalTriggerable.

value1 TValue1
value2 TValue2
value3 TValue3

Returns

bool

Whether any goal was successfully triggered.

Type Parameters

TObject
TValue1
TValue2
TValue3

Trigger<TObject, TValue1, TValue2, TValue3>(IGoalTriggerable, TObject, GoalTrigger<TObject, TValue1, TValue2, TValue3>, TValue1, TValue2, TValue3)

Triggers all auto-triggered goals with the specified type constraint in the given GoalSet. When calling this method, it should ideally be called on a specific subclass like AmountGoal, ConditionedGoal or DistinctGoal. When calling this method for a PersonLike, their GetCurrentGoals() should be used.

public static bool Trigger<TObject, TValue1, TValue2, TValue3>(IGoalTriggerable set, TObject obj, GoalTrigger<TObject, TValue1, TValue2, TValue3> trigger, TValue1 value1, TValue2 value2, TValue3 value3)

Parameters

set IGoalTriggerable

The goal set to search for auto-triggered goals

obj TObject

The object that triggered the given trigger.

trigger GoalTrigger<TObject, TValue1, TValue2, TValue3>

The goal trigger that is triggering this IGoalTriggerable.

value1 TValue1
value2 TValue2
value3 TValue3

Returns

bool

Whether any goal was successfully triggered.

Type Parameters

TObject
TValue1
TValue2
TValue3

TryTrigger(object, GoalTrigger, object)

Tries to trigger this goal triggerable. To call this method more easily, use Trigger(IGoalTriggerable, object, GoalTrigger, params object[]) or one of its overloads.

bool TryTrigger(object obj, GoalTrigger trigger, object value)

Parameters

obj object

The object that triggered the given trigger.

trigger GoalTrigger

The goal trigger that is triggering this IGoalTriggerable.

value object

The value that is associated with the trigger, which is usually an amount that a value has changed by, an amount of money, or similar.

Returns

bool

Whether this goal was successfully triggered.