Class ShipEaterAttackPattern

java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.combat.attackpatterns.ShipEaterAttackPattern
All Implemented Interfaces:
com.badlogic.gdx.utils.Json.Serializable

public class ShipEaterAttackPattern extends Component
The ShipEaterAttackPattern class defines the attack behavior of a ShipEater entity in the game. It allows the ShipEater to detect the ship and reduce repair state when in range. Adapted from Team 4's AttackPatternComponent.
  • Constructor Details

    • ShipEaterAttackPattern

      public ShipEaterAttackPattern(float attackFrequency)
  • Method Details

    • create

      public void create()
      Description copied from class: Component
      Called when the entity is created and registered. Initial logic such as calls to GetComponent should be made here, not in the constructor which is called before an entity is finished.
      Overrides:
      create in class Component
    • startAttack

      protected void startAttack()
      Initiates an attack loop.
    • attack

      protected void attack()
      Performs the attack action, which involves determining the nearest entity, changing direction, triggering attack events, and scheduling the next attack.
    • update

      public void update()
      Description copied from class: Component
      Called once per frame of the game, and should be used for most component logic. Not called if component is disabled.
      Overrides:
      update in class Component