Class FeatureUnit

java.lang.Object
me.hsgamer.minigamecore.base.FeatureUnit
All Implemented Interfaces:
Initializer
Direct Known Subclasses:
Arena, ArenaManager

public abstract class FeatureUnit extends Object implements Initializer
A unit to handle the arena Feature and GameState
  • Constructor Details

  • Method Details

    • loadGameStates

      protected abstract List<GameState> loadGameStates()
      Load the game states
      Returns:
      the game states
    • loadFeatures

      protected abstract List<Feature> loadFeatures()
      Load the features
      Returns:
      the features
    • getParent

      public FeatureUnit getParent()
      Get the parent FeatureUnit. It takes the first element from the result of getParentList(). If the result is empty, it will return null
      Returns:
      the parent FeatureUnit or null if not present
    • getParentList

      public List<FeatureUnit> getParentList()
      Set the parent FeatureUnit list
      Returns:
      the parent FeatureUnit list
    • init

      public void init()
      Description copied from interface: Initializer
      Init the object
      Specified by:
      init in interface Initializer
    • postInit

      public void postInit()
      Description copied from interface: Initializer
      Called on special event when all the objects are initialized
      Specified by:
      postInit in interface Initializer
    • clear

      public void clear()
      Description copied from interface: Initializer
      Clear the object
      Specified by:
      clear in interface Initializer
    • getGameState

      public <T extends GameState> T getGameState(Class<T> gameStateClass)
      Get the instance of the game state
      Type Parameters:
      T - the type of the game state
      Parameters:
      gameStateClass - the class of the game state
      Returns:
      the instance of the game state
    • getFeature

      public <T extends Feature> T getFeature(Class<T> featureClass)
      Get the instance of the feature
      Type Parameters:
      T - the type of the feature
      Parameters:
      featureClass - the class of the feature
      Returns:
      the instance of the feature
    • getGameStates

      public Set<Class<? extends GameState>> getGameStates(boolean deep)
      Get all classes of the game states
      Parameters:
      deep - if true, it will get all classes of the game states from the parent
      Returns:
      the classes
    • getFeatures

      public Set<Class<? extends Feature>> getFeatures(boolean deep)
      Get all classes of the features
      Parameters:
      deep - if true, it will get all classes of the features from the parent
      Returns:
      the classes