Class AchievementsStatsComponent

java.lang.Object
com.deco2800.game.components.Component
com.deco2800.game.components.achievements.AchievementsStatsComponent

public class AchievementsStatsComponent
extends Component
The class listens to game statistics given the forest area lifecycle and emits new achievement events
  • Constructor Details

  • Method Details

    • getAchievements

      public static java.util.List<BaseAchievementConfig> getAchievements()
      Returns a list of all achievements
      Returns:
      achievements
    • getUnlockedAchievements

      public static java.util.List<BaseAchievementConfig> getUnlockedAchievements()
      Returns a list of unlocked achievements
      Returns:
      unlockedAchievements
    • resetAchievements

      public static void resetAchievements()
      Lock all the achievements again
    • create

      public void create()
      Description copied from class: Component
      Called when the entity is created and registered. Initial logic such as calls to GetComponent should be made here, not in the constructor which is called before an entity is finished.
      Overrides:
      create in class Component
    • setSpaceshipAvoidSuccess

      public void setSpaceshipAvoidSuccess()
      Maintains the spaceshipAvoidSuccess status of the player
    • setDistance

      public void setDistance​(double distance)
      Maintains the distance traveled by the main player character in meters
    • setHealth

      public void setHealth​(int health)
      Maintains the current health of player
      Parameters:
      health - player's changed health
    • setTime

      public void setTime​(long time)
      Maintains the in game time
      Parameters:
      time - current game time
    • setScore

      public void setScore​(int score)
      Maintains the current score
      Parameters:
      score - the current game score
    • update

      public void update()
      Description copied from class: Component
      Called once per frame of the game, and should be used for most component logic. Not called if component is disabled.
      Overrides:
      update in class Component
    • handleItemPickup

      public void handleItemPickup​(java.lang.String itemName)
    • increment

      public void increment​(java.lang.String propertyName)
      Fetches the value for that particular property and increments it
      Parameters:
      propertyName - name of the achievement condition
    • setFirstAidByVal

      public void setFirstAidByVal​(int firstAids)
    • setGoldByVal

      public void setGoldByVal​(int gold)
    • setItemCount

      public void setItemCount()
      Maintains the count of the number of items picked up
    • setItemCountByVal

      public void setItemCountByVal​(int itemCount)
    • updateConditionsAndRevalidate

      public void updateConditionsAndRevalidate​(java.lang.String propertyName, double val)
      Updates the game variables in concern and checks if an achievement has been unlocked
      Parameters:
      propertyName - name of property
      val - property value