Interface IGoalTriggerable
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, 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<T>. When calling this method for a PersonLike, their GetCurrentGoals() should be used.
public static bool Trigger(IEnumerable<IGoalTriggerable> sets, object obj, GoalTrigger trigger, object[] values)
Parameters
setsIEnumerable<IGoalTriggerable>The set of goal set instances to search for auto-triggered goals
objobjectThe object that triggered the given
trigger.triggerGoalTriggerThe goal trigger that is triggering this IGoalTriggerable.
valuesobject[]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, 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<T>. When calling this method for a PersonLike, their GetCurrentGoals() should be used.
public static bool Trigger(IGoalTriggerable set, object obj, GoalTrigger trigger, object[] values)
Parameters
setIGoalTriggerableThe goal set to search for auto-triggered goals
objobjectThe object that triggered the given
trigger.triggerGoalTriggerThe goal trigger that is triggering this IGoalTriggerable.
valuesobject[]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<T>. 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
setsIEnumerable<IGoalTriggerable>The set of goal set instances to search for auto-triggered goals
objTObjectThe object that triggered the given
trigger.triggerGoalTrigger<TObject, TValue>The goal trigger that is triggering this IGoalTriggerable.
valueTValue
Returns
- bool
Whether any goal was successfully triggered.
Type Parameters
TObjectTValue
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<T>. 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
setIGoalTriggerableThe goal set to search for auto-triggered goals
objTObjectThe object that triggered the given
trigger.triggerGoalTrigger<TObject, TValue>The goal trigger that is triggering this IGoalTriggerable.
valueTValue
Returns
- bool
Whether any goal was successfully triggered.
Type Parameters
TObjectTValue
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<T>. 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
setsIEnumerable<IGoalTriggerable>The set of goal set instances to search for auto-triggered goals
objTObjectThe object that triggered the given
trigger.triggerGoalTrigger<TObject, TValue1, TValue2>The goal trigger that is triggering this IGoalTriggerable.
value1TValue1value2TValue2
Returns
- bool
Whether any goal was successfully triggered.
Type Parameters
TObjectTValue1TValue2
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<T>. 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
setIGoalTriggerableThe goal set to search for auto-triggered goals
objTObjectThe object that triggered the given
trigger.triggerGoalTrigger<TObject, TValue1, TValue2>The goal trigger that is triggering this IGoalTriggerable.
value1TValue1value2TValue2
Returns
- bool
Whether any goal was successfully triggered.
Type Parameters
TObjectTValue1TValue2
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<T>. 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
setsIEnumerable<IGoalTriggerable>The set of goal set instances to search for auto-triggered goals
objTObjectThe object that triggered the given
trigger.triggerGoalTrigger<TObject, TValue1, TValue2, TValue3>The goal trigger that is triggering this IGoalTriggerable.
value1TValue1value2TValue2value3TValue3
Returns
- bool
Whether any goal was successfully triggered.
Type Parameters
TObjectTValue1TValue2TValue3
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<T>. 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
setIGoalTriggerableThe goal set to search for auto-triggered goals
objTObjectThe object that triggered the given
trigger.triggerGoalTrigger<TObject, TValue1, TValue2, TValue3>The goal trigger that is triggering this IGoalTriggerable.
value1TValue1value2TValue2value3TValue3
Returns
- bool
Whether any goal was successfully triggered.
Type Parameters
TObjectTValue1TValue2TValue3
TryTrigger(object, GoalTrigger, object)
Tries to trigger this goal triggerable. To call this method more easily, use Trigger(IGoalTriggerable, object, GoalTrigger, object[]) or one of its overloads.
bool TryTrigger(object obj, GoalTrigger trigger, object value)
Parameters
objobjectThe object that triggered the given
trigger.triggerGoalTriggerThe goal trigger that is triggering this IGoalTriggerable.
valueobjectThe 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.