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 classes/interfaces inherited from interface com.csse3200.game.ai.tasks.Task
Task.Status
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
Fields inherited from class com.csse3200.game.ai.tasks.DefaultTask
owner, status
-
Constructor Summary
ConstructorDescriptionFireTowerCombatTask
(int priority, float maxRange) Starts the task running, triggers the initial 'IDLE' event -
Method Summary
Modifier and TypeMethodDescriptionfloat
Function for getting the turret's fire rate.int
gets the priority for the current task.getState()
boolean
detects targets from the centre of the tower to maxRange in a straight line.void
start()
starts this task and triggers the IDLE animationvoid
stop()
stops the current animation.void
update()
this method is called everytime state of the tower needs to be changed.void
finite 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:
start
in interfaceTask
- Overrides:
start
in classDefaultTask
-
update
public void update()this method is called everytime state of the tower needs to be changed.- Specified by:
update
in interfaceTask
- Overrides:
update
in 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:
stop
in interfaceTask
- Overrides:
stop
in classDefaultTask
-
getState
- Returns:
- returns the current state of the tower
-
getPriority
public int getPriority()gets the priority for the current task.- Specified by:
getPriority
in 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
-