CodeEffect Class
Definition
Section titled “Definition”Effect that runs code for the apply and update actions of an effect.
public class CodeEffect : CellEffectBase, ICellEffectInheritance object → CellEffectBase
Implements ICellEffect
Constructors
Section titled “Constructors”CodeEffect(string, Func<CodeEffect, ColoredGlyphBase, ColoredGlyphBase, bool>, Action<CodeEffect, TimeSpan>, Action<CodeEffect>)
Section titled “CodeEffect(string, Func<CodeEffect, ColoredGlyphBase, ColoredGlyphBase, bool>, Action<CodeEffect, TimeSpan>, Action<CodeEffect>)”Creates a cell effect that runs custom code instead of hardcoded effect actions.
public CodeEffect(string id, Func<CodeEffect, ColoredGlyphBase, ColoredGlyphBase, bool> apply, Action<CodeEffect, TimeSpan> update, Action<CodeEffect> restart)Parameters
Section titled “Parameters”id string
A user-definable identifier.
apply Func<CodeEffect, ColoredGlyphBase, ColoredGlyphBase, bool>
The code to run for ApplyToCell(ColoredGlyphBase, ColoredGlyphBase).
update Action<CodeEffect, TimeSpan>
The code to run for Update(TimeSpan).
restart Action<CodeEffect>
The code to run for Restart().
Properties
Section titled “Properties”A user defined identifier of the effect.
public string Id { get; set; }An object associated with this effect.
public object? Tag { get; set; }UseDuration
Section titled “UseDuration”When true, uses the Duration timer to stop this effect; otherwise false.
public bool UseDuration { get; set; }Duration
Section titled “Duration”The amount of time this effect runs for in seconds.
public TimeSpan Duration { get; set; }Methods
Section titled “Methods”ApplyToCell(ColoredGlyphBase, ColoredGlyphBase)
Section titled “ApplyToCell(ColoredGlyphBase, ColoredGlyphBase)”Applies the state of the effect to a cell.
public override bool ApplyToCell(ColoredGlyphBase cell, ColoredGlyphBase originalState)Parameters
Section titled “Parameters”cell ColoredGlyphBase
The surface cell using this effect.
originalState ColoredGlyphBase
The state of the cell prior to the effect being applied.
Returns
Section titled “Returns”bool
true when this method modified the cell; otherwise false.
Clone()
Section titled “Clone()”Not supported.
public override ICellEffect Clone()Returns
Section titled “Returns”Update(TimeSpan)
Section titled “Update(TimeSpan)”Updates the state of the effect.
public override void Update(TimeSpan delta)Parameters
Section titled “Parameters”delta TimeSpan
Time since the last call to this effect.
Restart()
Section titled “Restart()”Restarts the cell effect.
public override void Restart()ToString()
Section titled “ToString()”public override string ToString()