This module lets the attacker select a target to attack.

Data

ModeSelection(enum)

NoLocking - selects the target in front of the attacker, no position snapping, only rotating the attacker to face the target .

SoftLocking - allows the attacker to choose from all available targets in the range ,snapping the attacker's position and rotating the attacker to face the target .

Inspector

Selected Mode (ModeSelection) - select the locking mode for target selection.

Scan Layer (layer) - layer on which the target collider exists.

Soft Locking

Scan Area (float) - radius around the attacker, all the targets in this area can be selected.

Cooldown Timer (float) - after an attack is executed for how long to wait before allowing the selection of another target.

Camera Ref (camera) - reference to the camera orbiting the player. if empty, main camera will be selected.

No Locking

Range (float) - if a target is in the given range then rotate the attacker towards the target.

Debugging

DrawGizmos (bool) - allows you to see gizmos for current target and input direction.

Methods

public GameObject FindTarget()

Returns the selected target. For soft locking returns the target at which the direction input relative to camera forward was pressed. If no input is given the closest enemy is selected.