IStatus
MonoBehaviours that inherit IStatus will be able to add and remove status effects.
// Need to use StatusEffects namespace.
using StatusEffects;
using UnityEngine;
// Inheriting from MonoBehaviour and IStatus.
public class Example : MonoBehaviour, IStatus
{
public List<StatusEffect> effects { get; set; }
public void OnStatusEffect(StatusEffect statusEffect, bool added, int stack) { }
}Extensions
// Examples using the add and remove status effect extension.
public StatusEffectData slownessEffect;
public float effectTime = 5;
public void OnDamageTaken()
{
// Note that if no effect time
// is given it will be infinite.
this.AddStatusEffect(slownessEffect, effectTime);
}
public void OnLevelCompleted()
{
// Use this to remove all status effects.
this.RemoveAllStatusEffects();
// Use this to remove a specific status effect.
this.RemoveStatusEffect(slownessEffect);
}Effects
OnStatusEffect
Last updated