RiftMayhem/Assets/Scripts/AbilitySystem/Effects/DamageOverTimeVFXManager.cs
2025-10-01 20:04:35 +01:00

46 lines
1.2 KiB
C#

using UnityEngine;
public class DamageOverTimeVFXManager : MonoBehaviour
{
public ParticleSystem burningText;
public ParticleSystem poisonedText;
public ParticleSystem bleedingText;
public GameObject burnVFX;
public GameObject poisonVFX;
public GameObject bleedVFX;
EntityEventBroker broker;
TickingEffectHandler effectHandler;
private void Awake()
{
effectHandler = GetComponent<TickingEffectHandler>();
broker = GetComponent<EntityEventBroker>();
broker.OnAilmentApplied.Subscribe(OnAilmentApplied);
}
private void Update()
{
burnVFX?.SetActive(effectHandler.IsBurning());
poisonVFX?.SetActive(effectHandler.IsPoisoned());
bleedVFX?.SetActive(effectHandler.IsBleeding());
}
private void OnAilmentApplied(DamageType type)
{
switch (type)
{
case DamageType.Fire:
burningText?.Play();
break;
case DamageType.Physical:
bleedingText?.Play();
break;
case DamageType.Poison:
poisonedText?.Play();
break;
}
}
}