Class AdvancedEffect<TTriggerArgs>
More advanced version of Effect which allows for a parameter to be passed to the Trigger method.
Inherited Members
Namespace: GoRogue.Effects
Assembly: GoRogue.dll
Syntax
public abstract class AdvancedEffect<TTriggerArgs> : EffectBase
Type Parameters
Name | Description |
---|---|
TTriggerArgs | The type of the parameter that will be specified to the Trigger(TTriggerArgs) function (or its overloads) when called. |
Remarks
This effect type is useful when information about a particular trigger needs to be passed to the effect in order for it to work. For example, an effect which reacts to damage might need to know how much damage is being dealt in order to function.
Constructors
View SourceAdvancedEffect(string, int)
Constructor.
Declaration
protected AdvancedEffect(string name, int startingDuration)
Parameters
Type | Name | Description |
---|---|---|
string | name | Name for the effect. |
int | startingDuration | Starting duration for the effect. |
Methods
View SourceOnTrigger(out bool, TTriggerArgs)
Implement to take whatever action(s) the effect is supposed to accomplish. This function is called automatically when Trigger(out bool, TTriggerArgs) is called.
Declaration
protected abstract void OnTrigger(out bool cancelTrigger, TTriggerArgs args)
Parameters
Type | Name | Description |
---|---|---|
bool | cancelTrigger | When set to true, if the effect is being called by an EffectTrigger, the trigger will be cancelled; eg. any events which have yet to be triggered will not be triggered during the current call to TriggerEffects(). If the effect is not being called by an EffectTrigger, this parameter has no effect. |
TTriggerArgs | args | Arguments passed to the Trigger function. |
Trigger(out bool, TTriggerArgs)
Triggers the effect. If you're calling this function manually, you should use the Trigger(TTriggerArgs) function instead, unless you intend to manually support cancellation of a trigger.
Declaration
public void Trigger(out bool cancelTrigger, TTriggerArgs args)
Parameters
Type | Name | Description |
---|---|---|
bool | cancelTrigger | When set to true, if the effect is being called by an EffectTrigger, the trigger will be cancelled; eg. any events which have yet to be triggered will not be triggered during the current call to TriggerEffects(). If the effect is not being called by an EffectTrigger, this parameter has no effect. |
TTriggerArgs | args | The parameter to pass to the OnTrigger(out bool, TTriggerArgs) function. |
Remarks
Any effect that has Instant duration or duration 0 when this function is called will still have its OnTrigger(out bool, TTriggerArgs) function called.
Trigger(TTriggerArgs)
Triggers the effect, ignoring any result set to the boolean value in Trigger(out bool, TTriggerArgs). Should be called to trigger instantaneously occuring effects or effects that aren't part of an EffectTrigger and thus don't support trigger cancellation.
Declaration
public void Trigger(TTriggerArgs args)
Parameters
Type | Name | Description |
---|---|---|
TTriggerArgs | args | The parameter to pass to the OnTrigger(out bool, TTriggerArgs) function. |
Remarks
Any effect that has Instant duration or duration 0 when this function is called will still have its OnTrigger(out bool, TTriggerArgs) function called.