Package me.hsgamer.minigamecore.base
Class FeatureUnit
java.lang.Object
me.hsgamer.minigamecore.base.FeatureUnit
- All Implemented Interfaces:
Initializer
- Direct Known Subclasses:
Arena
,ArenaManager
-
Constructor Summary
ConstructorsConstructorDescriptionFeatureUnit
(List<FeatureUnit> parentList) Create a newFeatureUnit
FeatureUnit
(FeatureUnit... parent) Create a newFeatureUnit
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear the object<T extends Feature>
TgetFeature
(Class<T> featureClass) Get the instance of the featuregetFeatures
(boolean deep) Get all classes of the features<T extends GameState>
TgetGameState
(Class<T> gameStateClass) Get the instance of the game stategetGameStates
(boolean deep) Get all classes of the game statesGet the parentFeatureUnit
.Set the parentFeatureUnit
listvoid
init()
Init the objectLoad the featuresLoad the game statesvoid
postInit()
Called on special event when all the objects are initialized
-
Constructor Details
-
FeatureUnit
Create a newFeatureUnit
- Parameters:
parentList
- the parentFeatureUnit
list
-
FeatureUnit
Create a newFeatureUnit
- Parameters:
parent
- the parentFeatureUnit
-
-
Method Details
-
loadGameStates
Load the game states- Returns:
- the game states
-
loadFeatures
Load the features- Returns:
- the features
-
getParent
Get the parentFeatureUnit
. It takes the first element from the result ofgetParentList()
. If the result is empty, it will return null- Returns:
- the parent
FeatureUnit
or null if not present
-
getParentList
Set the parentFeatureUnit
list- Returns:
- the parent
FeatureUnit
list
-
init
public void init()Description copied from interface:Initializer
Init the object- Specified by:
init
in interfaceInitializer
-
postInit
public void postInit()Description copied from interface:Initializer
Called on special event when all the objects are initialized- Specified by:
postInit
in interfaceInitializer
-
clear
public void clear()Description copied from interface:Initializer
Clear the object- Specified by:
clear
in interfaceInitializer
-
getGameState
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
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
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
Get all classes of the features- Parameters:
deep
- if true, it will get all classes of the features from the parent- Returns:
- the classes
-