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 Person, 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 Person, 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.

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.