Skip to main content

OverTimeEffect

class SoftKitty.OverTimeEffect

OverTimeEffect defines the static configuration of an over-time effect, such as a buff, debuff, or damage-over-time effect.

This data determines what the effect does, not its runtime state.


Properties​

string uid​

Unique string identifier used to reference this effect in code and data.


int id​

Unique integer ID used internally for fast lookups.


string name​

Display name shown in UI (e.g. Poison, Burn, Freeze).


string category​

Category used to group effects, such as:

  • Buff
  • Debuff
  • DoT

Texture icon​

Icon used to represent the effect in UI. Supported loading methods include:

  • Direct Reference
  • Resources
  • Asset Bundles
  • Custom AssetLoader

float duration​

Total duration of the effect in seconds.


Color backGroundColor​

Background color used when displaying the effect in UI.


Color frameColor​

Frame or border color used in UI.


GraphBase DesignGraph​

(When Master Combat Core is installed) Defines the behavior of the effect using the GraphObject.

This graph controls:

  • Tick logic
  • Scaling
  • Conditional behavior

(When Master Combat Core is not installed) A ScriptableObject to attach to the over time effect.

  • Custom runtime logic can be implement into this ScriptableObject. Example:
    EffectLogic _logic = (EffectLogic)GameManager.GetOverTimeEffect(_uid).DesignGraph;
  • Custom inspector ui can be implement via:
public interface IOverTimeEffectInspectorModule { 
bool DrawInspector(OverTimeEffectObject myTarget, int i);
}

Example Code:

public class CombatOverTimeInspectorModule : IOverTimeEffectInspectorModule
{
public bool DrawInspector(OverTimeEffectObject myTarget, int i)
{
myTarget.overTimeEffects[i].DesignGraph = (GraphObject)EditorGUILayout.ObjectField(myTarget.overTimeEffects[i].DesignGraph, typeof(GraphObject), false);
...
}
}


[InitializeOnLoad]
public static class OverTimeEffectInspectorRegister
{
static OverTimeEffectInspectorRegister()
{
OverTimeEffectInspectorRegistry.Register(new CombatOverTimeInspectorModule());
}
}

List<DynamicFloat> DynamicVariables​

(When Master Combat Core is installed)

Dynamic Variables passed into the graph at runtime, allowing behavior to be modified without changing graph structure.


List<CustomField> mCustomField​

Custom data fields that allow you to attach arbitrary objects to this effect.


Methods​

GetCustomObject<T>(string key)​

Retrieves a custom object associated with this effect.

AudioClip clip = effect.GetCustomObject<AudioClip>("HitSound");

Useful for attaching:

  • Prefabs
  • Audio
  • VFX
  • Data assets