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.
-
Field Summary
FieldsModifier and TypeFieldDescriptioncom.badlogic.gdx.assets.AssetManager
Asset manager to load and manage assets.static DialogueBox
The shared dialogue box instance used by NPCs. -
Constructor Summary
ConstructorsConstructorDescriptionPrivate constructor to prevent instantiation of the NPCFactory.NPCFactory
(com.badlogic.gdx.assets.AssetManager assetManager) Creates an instance of NPCFactory. -
Method Summary
Modifier and TypeMethodDescriptionstatic Entity
Creates a Astro NPC to match the config filestatic Entity
Creates a generic Botanist NPC entity.static Entity
createBotanist
(BotanistConfig config) static Entity
static Entity
-
Field Details
-
dialogueBox
The shared dialogue box instance used by NPCs. -
assetManager
public com.badlogic.gdx.assets.AssetManager assetManagerAsset manager to load and manage assets.
-
-
Constructor Details
-
NPCFactory
public NPCFactory(com.badlogic.gdx.assets.AssetManager assetManager) Creates an instance of NPCFactory.- Parameters:
assetManager
- The asset manager to use for asset loading.
-
NPCFactory
public NPCFactory()Private constructor to prevent instantiation of the NPCFactory.This class should be used as a static util class.
-
-
Method Details
-
createBotanist
Creates a generic Botanist NPC entity.- Returns:
- The created Botanist NPC entity.
-
createBotanist
- Parameters:
config
- Creates a Botanist NPC to match the config file- Returns:
- The created Botanist NPC entity. and helps in triggering sound
-
createAstro
Creates a Astro NPC to match the config file- Returns:
- The created Astro NPC entity.
-
createJail
-
createFire
-