Class NPCFactory
java.lang.Object
com.csse3200.game.entities.factories.NPCFactory
Factory to create non-playable character (NPC) entities with predefined components.
Each NPC entity type should have a creation method that returns a corresponding entity. Predefined entity properties can be loaded from configs stored as json files which are defined in "NPCConfigs".
If needed, this factory can be separated into more specific factories for entities with similar characteristics.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Entity
createBear
(Entity target, List<Entity> enemies) Creates a Bear NPC and configures its behavior based on the provided target and enemies.static Entity
static Entity
createBigsawfish
(Entity target, List<Entity> enemies) static Entity
createChicken
(Entity target, List<Entity> enemies) Creates a Chicken NPC and configures its behavior based on the provided target and enemies.static Entity
Creates a Cow NPC, configures its behavior based on the provided target and enemies, and handles any conditional drops specific to the Cow NPC.static Entity
createEagle
(Entity target, List<Entity> enemies) Creates an Eagle NPC and configures its behavior based on the provided target and enemies.static Entity
static Entity
static Entity
createFish
(Entity target, List<Entity> enemies) Creates a Fish NPC, configures its behavior based on the provided target and enemies, and handles any conditional drops specific to the Fish NPC.static Entity
createFrog
(Entity target, List<Entity> enemies) Creates a Frog NPC and configures its behavior based on the provided target and enemies.static Entity
createLion
(Entity target, List<Entity> enemies) Creates a Lion NPC and configures its behavior based on the provided target and enemies.static Entity
createMacaw
(Entity target, List<Entity> enemies) static Entity
createMagpie
(Entity target, List<Entity> enemies) Creates a Magpie NPC and configures its behavior based on the provided target and enemies.static Entity
createMonkey
(Entity target, List<Entity> enemies) Creates a Monkey NPC and configures its behavior based on the provided target and enemies.static Entity
createOctopus
(Entity target, List<Entity> enemies) static Entity
createPigeon
(Entity target, List<Entity> enemies) static Entity
createSnake
(Entity target, List<Entity> enemies) Creates a Snake NPC and configures its behavior based on the provided target and enemies.static Entity
createTurtle
(Entity target, List<Entity> enemies) Creates a Turtle NPC and configures its behavior based on the provided target and enemies.static void
Ends a dialogue and takes it off the screenstatic void
initiateDialogue
(String[] animalSoundPaths, String[][] hintText) Initiates a dialogue by updating the dialogue box with the given text and optionally playing sounds.static void
initiateDialogue
(String[] animalSoundPaths, String[][] hintText, Entity entity) Initiates a dialogue by updating the dialogue box with the given text and optionally playing sounds.
-
Method Details
-
createCow
Creates a Cow NPC, configures its behavior based on the provided target and enemies, and handles any conditional drops specific to the Cow NPC.- Parameters:
target
- The entity that the Cow NPC will assist or follow.enemies
- A list of enemy entities that the Cow NPC will be aware of or react to.- Returns:
- A new Cow NPC entity with the appropriate behavior and configurations, including handling conditional item drops.
-
createFish
Creates a Fish NPC, configures its behavior based on the provided target and enemies, and handles any conditional drops specific to the Fish NPC.- Parameters:
target
- The entity that the Fish NPC will assist or follow.enemies
- A list of enemy entities that the Fish NPC will be aware of or react to.- Returns:
- A new Fish NPC entity with the appropriate behavior and configurations, including handling conditional item drops.
-
createLion
Creates a Lion NPC and configures its behavior based on the provided target and enemies.- Parameters:
target
- The entity that the Lion NPC will assist or follow.enemies
- A list of enemy entities that the Lion NPC will be aware of or react to.- Returns:
- A new Lion NPC entity with the appropriate behavior and configurations.
-
createTurtle
Creates a Turtle NPC and configures its behavior based on the provided target and enemies.- Parameters:
target
- The entity that the Turtle NPC will assist or follow.enemies
- A list of enemy entities that the Turtle NPC will be aware of or react to.- Returns:
- A new Turtle NPC entity with the appropriate behavior and configurations.
-
createEagle
Creates an Eagle NPC and configures its behavior based on the provided target and enemies.- Parameters:
target
- The entity that the Eagle NPC will assist or follow.enemies
- A list of enemy entities that the Eagle NPC will be aware of or react to.- Returns:
- A new Eagle NPC entity with the appropriate behavior and configurations.
-
createSnake
Creates a Snake NPC and configures its behavior based on the provided target and enemies.- Parameters:
target
- The entity that the Snake NPC will assist or follow.enemies
- A list of enemy entities that the Snake NPC will be aware of or react to.- Returns:
- A new Snake NPC entity with the appropriate behavior and configurations.
-
createMagpie
Creates a Magpie NPC and configures its behavior based on the provided target and enemies.- Parameters:
target
- The entity that the Magpie NPC will assist or follow.enemies
- A list of enemy entities that the Magpie NPC will be aware of or react to.- Returns:
- A new Magpie NPC entity with the appropriate behavior and configurations.
-
createChicken
Creates a Chicken NPC and configures its behavior based on the provided target and enemies.- Parameters:
target
- The entity that the Chicken NPC will assist or follow.enemies
- A list of enemy entities that the Chicken NPC will be aware of or react to.- Returns:
- A new Chicken NPC entity with the appropriate behavior and configurations.
-
createFrog
Creates a Frog NPC and configures its behavior based on the provided target and enemies.- Parameters:
target
- The entity that the Frog NPC will assist or follow.enemies
- A list of enemy entities that the Frog NPC will be aware of or react to.- Returns:
- A new Frog NPC entity with the appropriate behavior and configurations.
-
createMonkey
Creates a Monkey NPC and configures its behavior based on the provided target and enemies.- Parameters:
target
- The entity that the Monkey NPC will assist or follow.enemies
- A list of enemy entities that the Monkey NPC will be aware of or react to.- Returns:
- A new Monkey NPC entity with the appropriate behavior and configurations.
-
createBear
Creates a Bear NPC and configures its behavior based on the provided target and enemies.- Parameters:
target
- The entity that the Bear NPC will assist or follow.enemies
- A list of enemy entities that the Bear NPC will be aware of or react to.- Returns:
- A new Bear NPC entity with the appropriate behavior and configurations.
-
createEel
-
createOctopus
-
createBee
-
createPigeon
-
createBigsawfish
-
createMacaw
-
initiateDialogue
Initiates a dialogue by updating the dialogue box with the given text and optionally playing sounds. If the dialogue box service is not available, it creates a new instance.- Parameters:
animalSoundPaths
- An array of sound asset paths to play. If null or empty, no sounds are played.hintText
- An array of strings to display in the dialogue box.
-
initiateDialogue
Initiates a dialogue by updating the dialogue box with the given text and optionally playing sounds. If the dialogue box service is not available, it creates a new instance.- Parameters:
animalSoundPaths
- An array of sound asset paths to play. If null or empty, no sounds are played.hintText
- An array of strings to display in the dialogue box.entity
- The entity to highlight
-
endDialogue
public static void endDialogue()Ends a dialogue and takes it off the screen -
createFirefly
-