Class NPCFactory

java.lang.Object
com.csse3200.game.entities.factories.NPCFactory

public class NPCFactory extends Object
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 Details

    • dialogueBox

      public static DialogueBox dialogueBox
      The shared dialogue box instance used by NPCs.
    • assetManager

      public com.badlogic.gdx.assets.AssetManager assetManager
      Asset 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

      public static Entity createBotanist()
      Creates a generic Botanist NPC entity.
      Returns:
      The created Botanist NPC entity.
    • createBotanist

      public static Entity createBotanist(BotanistConfig config)
      Parameters:
      config - Creates a Botanist NPC to match the config file
      Returns:
      The created Botanist NPC entity. and helps in triggering sound
    • createAstro

      public static Entity createAstro()
      Creates a Astro NPC to match the config file
      Returns:
      The created Astro NPC entity.
    • createJail

      public static Entity createJail()
    • createFire

      public static Entity createFire()