Show / Hide Table of Contents

Class AdvancedEffect<TTriggerArgs>

More advanced version of Effect which allows for a parameter to be passed to the Trigger method.

Inheritance
object
EffectBase
AdvancedEffect<TTriggerArgs>
Inherited Members
EffectBase.ToString()
EffectBase.Duration
EffectBase.Name
EffectBase.Expired
object.GetType()
object.MemberwiseClone()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
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 Source

AdvancedEffect(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 Source

OnTrigger(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.

View Source

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.

View Source

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.

Extension Methods

Utility.Yield<T>(T)
  • View Source
In this article
Back to top Generated by DocFX