Class AnimatedProperty
java.lang.Object
group24.escaperoom.entities.properties.ItemProperty<PhantomProperty.PhantomPropertyValue>
group24.escaperoom.entities.properties.PhantomProperty
group24.escaperoom.entities.properties.AnimatedProperty
- All Implemented Interfaces:
com.badlogic.gdx.utils.Json.Serializable
Animated items have a texture that is `N` item widths wide, where N is the
number of frames in the animation and width is in pixels.
-
Nested Class Summary
Nested classes/interfaces inherited from class group24.escaperoom.entities.properties.PhantomProperty
PhantomProperty.PhantomPropertyValueNested classes/interfaces inherited from class group24.escaperoom.entities.properties.ItemProperty
ItemProperty.MenuType -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intConstant used for default frame guessingFields inherited from class group24.escaperoom.entities.properties.ItemProperty
owner -
Constructor Summary
ConstructorsConstructorDescriptionEmpty constructor forJson.SerializablecompatabilityAnimatedProperty(Item owner, int numFrames, float frameLength, int frameWidth, int frameHeight) -
Method Summary
Modifier and TypeMethodDescriptionvoidcloneProperty(Item newOwner) voiddefaultConfiguration(Item owner) Get aPropertyConfigurationthat contains all fields necessary to configure this property in theItemEditorgetType()voidmaybeAdvance(float delta) Maybe advance the animation framevoidread(com.badlogic.gdx.utils.Json json, com.badlogic.gdx.utils.JsonValue jsonData) voidUpdates the owner's texture based on the property.voidwrite(com.badlogic.gdx.utils.Json json) Methods inherited from class group24.escaperoom.entities.properties.PhantomProperty
getAvailableActions, getInputType, getPotentialValues, getValueClassMethods inherited from class group24.escaperoom.entities.properties.ItemProperty
getActions, getCurrentValue, getCurrentValues, getOwner, getPopOut, set, set, setOwner, unsafeSet, unsafeSet
-
Field Details
-
PIXELS_PER_WORLD_UNIT
public static final int PIXELS_PER_WORLD_UNITConstant used for default frame guessing- See Also:
-
-
Constructor Details
-
AnimatedProperty
public AnimatedProperty(Item owner, int numFrames, float frameLength, int frameWidth, int frameHeight) - Parameters:
owner- the owner of this propertynumFrames- is the number of frames available in the texture of the itemframeLength- is the time in seconds that each frame should play forframeWidth- is the width, in pixels, of an individual frameframeHeight- is the height, in pixels, of an individual frame
-
AnimatedProperty
public AnimatedProperty()Empty constructor forJson.Serializablecompatability
-
-
Method Details
-
getDescription
- Specified by:
getDescriptionin classItemProperty<PhantomProperty.PhantomPropertyValue>- Returns:
- the
PropertyDescriptionof this Property
-
maybeAdvance
public void maybeAdvance(float delta) Maybe advance the animation frame- Parameters:
delta- the amount of game time passed since the last call
-
getDisplayName
- Specified by:
getDisplayNamein classItemProperty<PhantomProperty.PhantomPropertyValue>- Returns:
- name of this property, used as a display string in menus
-
getType
- Specified by:
getTypein classItemProperty<PhantomProperty.PhantomPropertyValue>- Returns:
PropertyTypeof this property. This allows us to get the property of an item from it's property map- See Also:
-
cloneProperty
- Overrides:
clonePropertyin classItemProperty<PhantomProperty.PhantomPropertyValue>- Parameters:
newOwner- the new owner of this property- Returns:
- a clone of this item property (along with state and values) for a new item
-
updateTexture
public void updateTexture()Description copied from class:ItemPropertyUpdates the owner's texture based on the property. Properties which do not change the texture should not override this function. Typically used when reloading textures on already placed items.- Overrides:
updateTexturein classItemProperty<PhantomProperty.PhantomPropertyValue>
-
write
public void write(com.badlogic.gdx.utils.Json json) - Specified by:
writein interfacecom.badlogic.gdx.utils.Json.Serializable- Overrides:
writein classPhantomProperty
-
read
public void read(com.badlogic.gdx.utils.Json json, com.badlogic.gdx.utils.JsonValue jsonData) - Specified by:
readin interfacecom.badlogic.gdx.utils.Json.Serializable- Overrides:
readin classPhantomProperty
-
apply
- Overrides:
applyin classItemProperty<PhantomProperty.PhantomPropertyValue>- Parameters:
item- apply this property to this item
-
defaultConfiguration
- Overrides:
defaultConfigurationin classItemProperty<PhantomProperty.PhantomPropertyValue>- Parameters:
owner- create a default configuration of this property for the given owner
-
getCustomItemConfigurationMenu
Description copied from class:ItemPropertyGet aPropertyConfigurationthat contains all fields necessary to configure this property in theItemEditor- Overrides:
getCustomItemConfigurationMenuin classItemProperty<PhantomProperty.PhantomPropertyValue>- Returns:
- Some(
PropertyConfiguration) should this property need configuration
-