RiftMayhem/Assets/Scripts/AbilitySystem/Effects/DamageOverTimeVFXManager.cs

46 lines
1.1 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;
}
}
}