Class EnemyFactory
java.lang.Object
com.csse3200.game.entities.factories.EnemyFactory
Factory for creating enemy and boss entities.
Build enemies via dedicated helpers.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic EntitycreateAutoBomberDrone(Entity target, com.badlogic.gdx.math.Vector2[] patrolRoute) Create an automatic bomber drone that continuously drops bombs while patrolling.static EntitycreateBomberDrone(Entity target, com.badlogic.gdx.math.Vector2 spawnPos, String bomberId) Create a bomber-style drone with integrated cone light detection.static EntitycreateBossEnemy(Entity target, com.badlogic.gdx.math.Vector2 spawnPos) Builds the boss entity for the boss level with core combat/AI/rendering components and a single emptyBossSpawnerComponent.static EntitycreateBossSelfDestructDrone(Entity target, com.badlogic.gdx.math.Vector2 spawnPos) Convenience overload for creating a boss-spawned self-destruct drone with default atlas/speed/effect timings (CHASER-like baseline).static EntitycreateBossSelfDestructDrone(Entity target, com.badlogic.gdx.math.Vector2 spawnPos, EnemyFactory.DroneVariant variant) Variant-aware overload for creating a boss self-destruct drone, Selects atlas, speed and bomb effect timing based on variant.static EntitycreateBossSelfDestructDroneInternal(Entity target, com.badlogic.gdx.math.Vector2 spawnPos, String atlasPath, float speed, float bombEffectFrameDuration) Creates a self-destruct drone variant specifically for boss spawning.static EntitycreateDrone(Entity target, com.badlogic.gdx.math.Vector2 spawnPos) Creates a drone enemy that starts idle.static EntitycreatePatrollingBomberDrone(Entity target, com.badlogic.gdx.math.Vector2[] patrolRoute, String bomberId) Create a patrolling bomber drone with integrated light detection.static EntitycreatePatrollingDrone(Entity target, com.badlogic.gdx.math.Vector2[] patrolRoute) Same as basic drone enemy but patrols a given route, alternatively chasing a target when activated.static EntitycreateSelfDestructionDrone(Entity target, com.badlogic.gdx.math.Vector2 spawnPos) Create a self-destruction drone variant that chases its target then explodes near the target.
-
Method Details
-
createDrone
Creates a drone enemy that starts idle. When activated by a security camera, starts chasing its target. Has drone-specific animation, combat stats and chase task.- Parameters:
target- that drone pursues when chasingspawnPos- the starting world position of the enemy- Returns:
- drone enemy entity
-
createPatrollingDrone
public static Entity createPatrollingDrone(Entity target, com.badlogic.gdx.math.Vector2[] patrolRoute) Same as basic drone enemy but patrols a given route, alternatively chasing a target when activated.- Parameters:
target- that drone pursues when chasingpatrolRoute- contains list of waypoints in patrol route- Returns:
- a patrolling drone enemy entity
-
createBomberDrone
public static Entity createBomberDrone(Entity target, com.badlogic.gdx.math.Vector2 spawnPos, String bomberId) Create a bomber-style drone with integrated cone light detection. The bomber uses a downward-facing cone light to detect and bomb targets below.- Parameters:
target- that drone pursues when bombing/chasingspawnPos- the starting world position of the enemybomberId- unique ID for this bomber (used for light registration)- Returns:
- a bomber drone entity with light detection
-
createPatrollingBomberDrone
public static Entity createPatrollingBomberDrone(Entity target, com.badlogic.gdx.math.Vector2[] patrolRoute, String bomberId) Create a patrolling bomber drone with integrated light detection. The bomber patrols a route and uses its cone light to detect targets below.- Parameters:
target- that drone pursues when bombing/chasingpatrolRoute- array of waypoints defining the patrol routebomberId- unique ID for this bomber- Returns:
- a patrolling bomber drone entity
-
createAutoBomberDrone
public static Entity createAutoBomberDrone(Entity target, com.badlogic.gdx.math.Vector2[] patrolRoute) Create an automatic bomber drone that continuously drops bombs while patrolling. The bomber stays in drop animation and drops bombs every second while moving. The bomb drop task briefly takes priority every second to drop a bomb, then immediately yields back to patrol.- Parameters:
target- reference entity (usually player) for bomb directionpatrolRoute- array of waypoints defining the patrol route- Returns:
- an automatic bombing patrol drone entity
-
createSelfDestructionDrone
public static Entity createSelfDestructionDrone(Entity target, com.badlogic.gdx.math.Vector2 spawnPos) Create a self-destruction drone variant that chases its target then explodes near the target.- Parameters:
target- entity to pursue and self destruct nearspawnPos- optional spawn position- Returns:
- a self-destruction drone entity
-
createBossSelfDestructDroneInternal
public static Entity createBossSelfDestructDroneInternal(Entity target, com.badlogic.gdx.math.Vector2 spawnPos, String atlasPath, float speed, float bombEffectFrameDuration) Creates a self-destruct drone variant specifically for boss spawning. Minimal behaviour (no teleport or cooldown functionality). The drone is activated immediately and enters a permanent chase state until exploding.- Parameters:
target- entity the player will pursue and explode nearspawnPos- optional spawn positionatlasPath- texture atlas path used for drone animationsspeed- max movement speedbombEffectFrameDuration- per-frame duration for the bomb_effect- Returns:
- a constructed self-destruct chase drone
-
createBossSelfDestructDrone
public static Entity createBossSelfDestructDrone(Entity target, com.badlogic.gdx.math.Vector2 spawnPos) Convenience overload for creating a boss-spawned self-destruct drone with default atlas/speed/effect timings (CHASER-like baseline).- Parameters:
target- entity to chasespawnPos- optional spawn position- Returns:
- a constructed self-destruct chase drone
-
createBossSelfDestructDrone
public static Entity createBossSelfDestructDrone(Entity target, com.badlogic.gdx.math.Vector2 spawnPos, EnemyFactory.DroneVariant variant) Variant-aware overload for creating a boss self-destruct drone, Selects atlas, speed and bomb effect timing based on variant. Behaviour remains the same for boss-spawned drones: no teleport or cooldown, immediate chase on activation.- Parameters:
target- entity to chasespawnPos- optional spawn positionvariant- drone variant that determines atlas/speed/effect tuning- Returns:
- a constructed self-destruct chase drone
-
createBossEnemy
Builds the boss entity for the boss level with core combat/AI/rendering components and a single emptyBossSpawnerComponent. Triggers are configured externally inSpawners. - Chases the player -BossLaserAttackComponentfor ranged laser attacks -BossTouchKillComponentfor player death on contact- Parameters:
target- the target entity used by attack and AI componentsspawnPos- optional initial world position- Returns:
- the constructed boss entity
-