Effect Component - UQcsse3200/2023-studio-3 GitHub Wiki

Overview

When a projectile applies an effect to an entity, it accesses this component which is attached to the entity. It calls the applyEffect method to apply either a burn, slow, or stun effect to the target entity.

How To Use It

To use the EffectComponent, you must first add the component to a game entity. Here's a simple example of how to attach it:

EffectComponent effectComp = new EffectComponent(true);
entity.addComponent(effectComp);

Here is an example of how to apply a burn effect

EffectComponent effectComp = targetEntity.getComponent(EffectComponent.class);
effectComp.applyEffect(ProjectileEffects.BURN, hostEntity, targetEntity);