Class GoalTrigger
A goal trigger is used by AutoTriggerGoal instances to determine whether they should be triggered. Goal triggers are compared only by their Name, so mods can add goal triggers that work for other mods without explicit compatibility.
public class GoalTrigger : IEquatable<GoalTrigger>
- Inheritance
-
GoalTrigger
- Implements
- Inherited Members
- Extension Methods
Constructors
GoalTrigger(string, Type[], Type[])
Creates a new goal trigger with the given settings.
public GoalTrigger(string name, Type[] validObjects, Type[] validGoals)
Parameters
name
stringThis goal trigger's name.
validObjects
Type[]A set of types that determine which objects are valid trigger objects for this goal trigger. This validates the
obj
parameter of Trigger(IGoalTriggerable, object, GoalTrigger, params object[]).validGoals
Type[]A set of types that determine which values are valud trigger values for this goal trigger. This validates the
values
parameter of Trigger(IGoalTriggerable, object, GoalTrigger, params object[]).
Fields
ActionCompleted
public static readonly GoalTrigger ActionCompleted
Field Value
ActionEnded
A goal trigger for when an Action is completed in any way (the CompletionType doesn't matter) by a Person.
public static readonly GoalTrigger ActionEnded
Field Value
ActionUpdate
A goal trigger for when an Action is updated.
public static readonly GoalTrigger ActionUpdate
Field Value
EarnMoney
A goal trigger for when a Person earns money through an Action or Project. By default, this trigger is used in EarnMoney(float, object).
public static readonly GoalTrigger EarnMoney
Field Value
EmotionGained
A goal trigger for when a EmotionModifier is added to a Person using AddEmotion(EmotionModifier, int, TimeSpan, IEmotionSource, bool).
public static readonly GoalTrigger EmotionGained
Field Value
EmotionLost
A goal trigger for when a EmotionModifier is removed from a Person in RemoveEmotion(EmotionModifier) or when it runs out.
public static readonly GoalTrigger EmotionLost
Field Value
FoodEaten
A goal trigger for when a FoodType item is eaten by a Person in InvokeOnEaten(Action, FoodTypedItem).
public static readonly GoalTrigger FoodEaten
Field Value
FurnitureCreated
A goal trigger for when a Furniture item is created by a Person. By default, this trigger is used in SetCreator(Person, bool).
public static readonly GoalTrigger FurnitureCreated
Field Value
Name
This goal trigger's name.
public readonly string Name
Field Value
PersonUpdate
A goal trigger for when a Person's Update(GameTime, TimeSpan, float) method is called.
public static readonly GoalTrigger PersonUpdate
Field Value
ProjectCompleted
A goal trigger for when a Project is marked as completed in OnCompleted().
public static readonly GoalTrigger ProjectCompleted
Field Value
ValidObjects
A set of types that determine which objects are valid trigger objects for this goal trigger. This validates the obj
parameter of Trigger(IGoalTriggerable, object, GoalTrigger, params object[]).
public readonly Type[] ValidObjects
Field Value
- Type[]
ValidValues
A set of types that determine which values are valud trigger values for this goal trigger. This validates the values
parameter of Trigger(IGoalTriggerable, object, GoalTrigger, params object[]).
public readonly Type[] ValidValues
Field Value
- Type[]
Methods
Equals(object)
public override bool Equals(object obj)
Parameters
obj
object
Returns
Equals(GoalTrigger)
public bool Equals(GoalTrigger other)
Parameters
other
GoalTrigger
Returns
GetHashCode()
public override int GetHashCode()
Returns
IsObjectCompatible(Type)
Returns whether an object of the given objType
is compatible with this goal trigger, based on ValidObjects.
This validates the obj
parameter of Trigger(IGoalTriggerable, object, GoalTrigger, params object[])
public bool IsObjectCompatible(Type objType)
Parameters
objType
TypeThe type of the object.
Returns
- bool
Whether the object is compatible.
IsValueCompatible(Type)
Returns whether a value of the given valueType
is compatible with this goal trigger, based on ValidValues.
This validates the values
parameter of Trigger(IGoalTriggerable, object, GoalTrigger, params object[])
public bool IsValueCompatible(Type valueType)
Parameters
valueType
TypeThe type of the value.
Returns
- bool
Whether the value is compatible.