Class WallTowerDestructionTask
java.lang.Object
com.csse3200.game.ai.tasks.DefaultTask
com.csse3200.game.components.tasks.WallTowerDestructionTask
- All Implemented Interfaces:
PriorityTask
,Task
The FireworksTowerCombatTask runs the AI for the FireworksTower class. The tower scans for mobs and targets in a
straight line from its centre coordinate and executes the trigger phrases for animations depeending on the current
state of tower.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.csse3200.game.ai.tasks.Task
Task.Status
-
Field Summary
Fields inherited from class com.csse3200.game.ai.tasks.DefaultTask
owner, status
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
returns the current priority of the taskgetState()
Returns the state that the tower is currently inboolean
Searches for enemies/mobs in a straight line from the centre of the tower to maxRange in a straight line.void
start()
Starts the task running and starts the Idle animationvoid
stop()
stops the current animation and switches back the state of the tower to IDLE.void
update()
updates the current state of the tower based on the current state of the game.void
This method acts is the state machine for StunTower.Methods inherited from class com.csse3200.game.ai.tasks.DefaultTask
create, getStatus
-
Field Details
-
IDLE
- See Also:
-
DEATH
- See Also:
-
towerState
-
-
Constructor Details
-
WallTowerDestructionTask
public WallTowerDestructionTask(int priority, float maxRange) - Parameters:
priority
- Task priority when targets are detected (0 when nothing is present)maxRange
- Maximum effective range of the StunTower.
-
-
Method Details
-
start
public void start()Starts the task running and starts the Idle animation- Specified by:
start
in interfaceTask
- Overrides:
start
in classDefaultTask
-
update
public void update()updates the current state of the tower based on the current state of the game. If enemies are detected, attack state is activated and otherwise idle state remains.- Specified by:
update
in interfaceTask
- Overrides:
update
in classDefaultTask
-
updateTowerState
public void updateTowerState()This method acts is the state machine for StunTower. Relevant animations are triggered based on relevant state of the game. If enemies are detected, state of the tower is changed to attack state. -
getState
Returns the state that the tower is currently in- Returns:
- this.towerState
-
stop
public void stop()stops the current animation and switches back the state of the tower to IDLE.- Specified by:
stop
in interfaceTask
- Overrides:
stop
in classDefaultTask
-
getPriority
public int getPriority()returns the current priority of the task- Specified by:
getPriority
in interfacePriorityTask
- Returns:
- (int) active priority if target is visible and inactive priority otherwise
-
isTargetVisible
public boolean isTargetVisible()Searches for enemies/mobs in a straight line from the centre of the tower to maxRange in a straight line.- Returns:
- true if targets are detected, false otherwise
-