Class PlantAreaOfEffectComponent

All Implemented Interfaces:
com.badlogic.gdx.utils.Json.Serializable

public class PlantAreaOfEffectComponent extends HitboxComponent
Class to add an Area of Effect to all plants.
  • Constructor Details

    • PlantAreaOfEffectComponent

      public PlantAreaOfEffectComponent(float radius, String effectType)
      Constructor for the Area of Effect class.
      Parameters:
      radius - - The initial radius of the area.
      effectType - - The type of effect.
  • Method Details

    • getEffectType

      public String getEffectType()
    • setEffectType

      public void setEffectType(String effectType)
      Update the current effect being executed.
      Parameters:
      effectType - - The effect to be implemented.
    • getRadius

      public float getRadius()
      Returns the radius of the area of effect for the plant.
      Returns:
      The radius of the area of effect.
    • setRadius

      public void setRadius(float radius)
      Set the radius of the area.
      Parameters:
      radius - - the new radius of the area.
    • getEntitiesInRange

      public List<Entity> getEntitiesInRange()
      Returns a list of entities within the range.
      Returns:
      A list of entities within the range.
    • create

      public void create()
      Sets up a radius for the collider and listens to relevant services.
      Overrides:
      create in class HitboxComponent
    • onCollisionStart

      public void onCollisionStart(com.badlogic.gdx.physics.box2d.Fixture me, com.badlogic.gdx.physics.box2d.Fixture other)
      Adds entity to entitiesInRange on collision start. NOTE: This function is copied from the InteractionDetector class, written by someone else.
      Parameters:
      me - The fixture of this component.
      other - The fixture of the colliding entity.
    • onCollisionEnd

      public void onCollisionEnd(com.badlogic.gdx.physics.box2d.Fixture me, com.badlogic.gdx.physics.box2d.Fixture other)
      Removes entity from entitiesInRange on collision end. NOTE: This function is copied from the InteractionDetector class, written by someone else.
      Parameters:
      me - The fixture of this component.
      other - The fixture of the colliding entity.