Class AttackPatternComponent

java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.combat.attackpatterns.AttackPatternComponent
All Implemented Interfaces:
com.badlogic.gdx.utils.Json.Serializable
Direct Known Subclasses:
BatAttackPattern, DragonflyAttackPattern, OxygenEaterAttackPattern

public class AttackPatternComponent extends Component
The AttackPatternComponent is responsible for managing the attack patterns of entities within the game. It allows entities to initiate attacks with a specified frequency and provides methods for starting and scheduling attacks.
  • Field Details

    • attackFrequency

      protected final float attackFrequency
      Frequency of attacks in seconds
    • interactionDetector

      protected InteractionDetector interactionDetector
      Entity's interaction detector
    • currentAttackEvent

      protected ScheduledEvent currentAttackEvent
      Scheduled attack event
  • Constructor Details

    • AttackPatternComponent

      public AttackPatternComponent(float attackFrequency)
  • Method Details

    • create

      public void create()
      Initializes the HostileAttackPattern component when it is created. This method sets up event listeners and interaction detection for the oxygen eater.
      Overrides:
      create in class Component
    • startAttack

      protected void startAttack(Entity target)
      Initiates an attack loop.
      Parameters:
      target - The detected target entity. needed for event listener, unused
    • attack

      protected void attack()
      Attacks and schedules next attack.