Class AchievementFactory

java.lang.Object
com.deco2800.game.entities.factories.AchievementFactory

public class AchievementFactory
extends java.lang.Object
Factory to create Achievement entities with predefined conditions.

Each Achievement entity type should have a creation method that returns a corresponding entity. Predefined achievement entity conditions can be loaded from configs stored as json files which are defined in "achievements.json".

  • Constructor Details

  • Method Details

    • createAchievementEntity

      public static Entity createAchievementEntity()
      Returns a list of achievements from the "achievements.json" file
      Returns:
      achievements - A list of achievements inflated from the JSON file
    • getAchievements

      public static java.util.List<BaseAchievementConfig> getAchievements()
    • getPropertyList

      public static java.util.Map<java.lang.String,​PropertyListDefaults> getPropertyList()
      Dynamically load and return the list of properties and their defaults. Returns a mapping of property name and (operations, defaultValue).
      Returns:
      propertyList list of properties with operations to be conducted and defaults
    • getTextures

      public static java.lang.String[] getTextures()
      Returns a list of paths to corresponding achievement texture images
      Returns:
      paths - A list of paths inflated from achievement list generated using getAchievements()
    • getTrophyTextures

      public static java.lang.String[] getTrophyTextures()
    • getAchievementTrophy

      public static java.lang.String getAchievementTrophy​(BaseAchievementConfig achievement)
    • getAchievementByNameAndType

      public static BaseAchievementConfig getAchievementByNameAndType​(java.lang.String name, java.lang.String type)