Class DroidCombatTask
java.lang.Object
com.csse3200.game.ai.tasks.DefaultTask
com.csse3200.game.components.tasks.DroidCombatTask
- All Implemented Interfaces:
 PriorityTask,Task
The DroidCombatTask runs the AI for the DroidTower class. The tower will scan for targets in a straight line
 from its center point until a point at (x + maxRange, y), where x,y are the cooridinates of the tower's center
 position. This component should be added to an AiTaskComponent attached to the tower instance.
- 
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 Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class com.csse3200.game.ai.tasks.DefaultTask
owner, status - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionfloatFunction for getting the turret's fire rate.intReturns the current priority of the task.getState()Returns the current state of the tower.booleanUses a raycast to determine whether there are any targets in detection rangevoidstart()Starts the Task running, triggers the initial "idleStart" event.voidstop()For stopping the running taskvoidupdate()The update method is what is run every time the TaskRunner in the AiTaskComponent calls update().voidDroid tower state machine.Methods inherited from class com.csse3200.game.ai.tasks.DefaultTask
create, getStatus 
- 
Field Details
- 
GO_UP
- See Also:
 
 - 
GO_DOWN
- See Also:
 
 - 
ATTACK_UP
- See Also:
 
 - 
ATTACK_DOWN
- See Also:
 
 - 
WALK
- See Also:
 
 - 
DEATH
- See Also:
 
 - 
IDLE
- See Also:
 
 - 
SHOOT_UP
- See Also:
 
 - 
SHOOT_DOWN
- See Also:
 
 - 
towerState
 
 - 
 - 
Constructor Details
- 
DroidCombatTask
public DroidCombatTask(int priority, float maxRange) - Parameters:
 priority- Task priority when targets are detected (0 when nothing detected). Must be a positive integer.maxRange- Maximum effective range of the weapon tower. This determines the detection distance of targets
 
 - 
 - 
Method Details
- 
start
public void start()Starts the Task running, triggers the initial "idleStart" event.- Specified by:
 startin interfaceTask- Overrides:
 startin classDefaultTask
 - 
update
public void update()The update method is what is run every time the TaskRunner in the AiTaskComponent calls update(). triggers events depending on the presence or otherwise of targets in the detection range- Specified by:
 updatein interfaceTask- Overrides:
 updatein classDefaultTask
 - 
updateTowerState
public void updateTowerState()Droid tower state machine. Updates tower state by scanning for mobs, and triggers the appropriate events corresponding to the STATE enum. - 
stop
public void stop()For stopping the running task- Specified by:
 stopin interfaceTask- Overrides:
 stopin classDefaultTask
 - 
getState
Returns the current state of the tower.- Returns:
 - the current state of the tower.
 
 - 
getPriority
public int getPriority()Returns the current priority of the task.- Specified by:
 getPriorityin interfacePriorityTask- Returns:
 - active priority value if targets detected, inactive priority otherwise
 
 - 
isTargetVisible
public boolean isTargetVisible()Uses a raycast to determine whether there are any targets in detection range- Returns:
 - true if a target is visible, false otherwise
 
 - 
getFireRateInterval
public float getFireRateInterval()Function for getting the turret's fire rate.- Returns:
 - The fireRateInterval variable
 
 
 -