Class FireTowerCombatTask
java.lang.Object
com.csse3200.game.ai.tasks.DefaultTask
com.csse3200.game.components.tasks.FireTowerCombatTask
- All Implemented Interfaces:
PriorityTask,Task
The FireTowerCombatTask runs the AI for the FireTower class. The tower implementing this task will scan for enemies
in a straight line from the current position to a maxRange, and change the state of the tower.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface com.csse3200.game.ai.tasks.Task
Task.Status -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class com.csse3200.game.ai.tasks.DefaultTask
owner, status -
Constructor Summary
ConstructorsConstructorDescriptionFireTowerCombatTask(int priority, float maxRange) Starts the task running, triggers the initial 'IDLE' event -
Method Summary
Modifier and TypeMethodDescriptionfloatFunction for getting the turret's fire rate.intgets the priority for the current task.getState()booleandetects targets from the centre of the tower to maxRange in a straight line.voidstart()starts this task and triggers the IDLE animationvoidstop()stops the current animation.voidupdate()this method is called everytime state of the tower needs to be changed.voidfinite state machine for the FireTower.Methods inherited from class com.csse3200.game.ai.tasks.DefaultTask
create, getStatus
-
Field Details
-
IDLE
- See Also:
-
PREP_ATTACK
- See Also:
-
ATTACK
- See Also:
-
DEATH
- See Also:
-
towerState
-
-
Constructor Details
-
FireTowerCombatTask
public FireTowerCombatTask(int priority, float maxRange) Starts the task running, triggers the initial 'IDLE' event
-
-
Method Details
-
start
public void start()starts this task and triggers the IDLE animation- Specified by:
startin interfaceTask- Overrides:
startin classDefaultTask
-
update
public void update()this method is called everytime state of the tower needs to be changed.- Specified by:
updatein interfaceTask- Overrides:
updatein classDefaultTask
-
updateTowerState
public void updateTowerState()finite state machine for the FireTower. Detects mobs in a straight line and changes the state of the tower. -
stop
public void stop()stops the current animation.- Specified by:
stopin interfaceTask- Overrides:
stopin classDefaultTask
-
getState
- Returns:
- returns the current state of the tower
-
getPriority
public int getPriority()gets the priority for the current task.- Specified by:
getPriorityin interfacePriorityTask- Returns:
- (int) active priority if target is visible and inactive priority otherwise
-
isTargetVisible
public boolean isTargetVisible()detects targets from the centre of the tower to maxRange in a straight line.- Returns:
- true if mobs are present and false otherwise.
-
getFireRateInterval
public float getFireRateInterval()Function for getting the turret's fire rate.- Returns:
- The fireRateInterval variable
-