Class Conditional
java.lang.Object
group24.escaperoom.entities.properties.conditionals.Conditional
- All Implemented Interfaces:
com.badlogic.gdx.utils.Json.Serializable,ItemPropertyValue
- Direct Known Subclasses:
AlwaysActive,BinaryConditional,EmptyConditional,ItemContainsItem,ItemInArea,KaryConditional,PlayerHasItem,PlayerInTiles,RequiresItems,UnaryConditional
public abstract class Conditional
extends Object
implements com.badlogic.gdx.utils.Json.Serializable, ItemPropertyValue
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionWhether or not to limit the number of children below this conditional By default assumes the condition can have no childrenclone()booleanabstract booleanevaluate(GameContext ctx) com.badlogic.gdx.utils.Array<Conditional>Returns an array of this conditional dependents, if they have any.getDisplay(Menu parent) Conditionals are not represented in Menusabstract <CC extends com.badlogic.gdx.scenes.scene2d.Actor & ConfigurationMenu.HandlesMenuClose>
Optional<CC>Primarily used in theConditionalUIabstract StringgetName()abstract ConditionalTypegetType()booleanpoll(GameContext ctx) Given the game context, return whether or not this conditional needs to be polled.booleanvoidsetChildren(Conditional... conds) Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.badlogic.gdx.utils.Json.Serializable
read, write
-
Constructor Details
-
Conditional
public Conditional()
-
-
Method Details
-
evaluate
- Parameters:
ctx- theGameContextwhich should be used to evaluate thisConditional- Returns:
- whether or not this
Conditionalistrue
-
getType
- Returns:
- the type of this conditional
-
getName
- Returns:
- the name of this
Conditional
-
requiresPoll
public boolean requiresPoll()- Returns:
- whether or not this
Conditionalrequires polling
-
poll
Given the game context, return whether or not this conditional needs to be polled. It must be valid to poll the conditional even after this function returns false- Parameters:
ctx- the game context- Returns:
- whether or not this conditional still needs to be polled
-
childCount
Whether or not to limit the number of children below this conditional By default assumes the condition can have no children- Returns:
- Some(count) if this conditional has a limit to the number of children
-
clone
-
getChildren
Returns an array of this conditional dependents, if they have any. The array will be the same length aschildCount()- Returns:
- an array of conditionals which this conditional depends on
-
equals
-
setChildren
- Parameters:
conds- theConditionals to set
-
getDisplay
Conditionals are not represented in Menus- Specified by:
getDisplayin interfaceItemPropertyValue- Parameters:
parent- the menu spawning this entry- Returns:
- the
Menu.MenuEntrydescribing thisItemPropertyValue
-
getEditorConfiguration
public abstract <CC extends com.badlogic.gdx.scenes.scene2d.Actor & ConfigurationMenu.HandlesMenuClose> Optional<CC> getEditorConfiguration(LevelEditorScreen editor) Primarily used in theConditionalUI- Type Parameters:
CC- an actor type implentingConfigurationMenu.HandlesMenuCloseshould this be uncessary, useSimpleUI- Parameters:
editor- theLevelEditorScreenon which this menu will be spawned- Returns:
- Some(CC) should this
Conditionalrequire additional configuration.
-