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
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.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
attack()
Performs the attack action, which involves determining the nearest entity, changing direction, triggering attack events, and scheduling the next attack.void
create()
Called when the entity is created and registered.protected void
Initiates an attack loop.void
update()
Called once per frame of the game, and should be used for most component logic.Methods inherited from class com.csse3200.game.components.Component
dispose, earlyUpdate, getEntity, read, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, write
-
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. -
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.
-