Package gaiasky.scene.view
Class PositionView
java.lang.Object
gaiasky.scene.view.AbstractView
gaiasky.scene.view.PositionView
- All Implemented Interfaces:
IPosition
- Direct Known Subclasses:
OctreeObjectView
A view which exposes position and velocity properties of an entity.
Can be reused
-
Field Summary
Fields inherited from class gaiasky.scene.view.AbstractView
entity
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
componentsCheck
(com.badlogic.ashley.core.Entity entity) Check whether the current components are the same as the components of the given entity.protected void
Contains actions to take after a new entity has been set.protected void
entityCheck
(com.badlogic.ashley.core.Entity entity) Checks whether the given entity is suitable for this view.protected void
This method is called when the entity of this view is cleared.Methods inherited from class gaiasky.scene.view.AbstractView
check, clearEntity, getEntity, isEmpty, isValid, setEntity
-
Constructor Details
-
PositionView
public PositionView(com.badlogic.ashley.core.Entity entity)
-
-
Method Details
-
componentsCheck
protected boolean componentsCheck(com.badlogic.ashley.core.Entity entity) Description copied from class:AbstractView
Check whether the current components are the same as the components of the given entity.- Specified by:
componentsCheck
in classAbstractView
- Parameters:
entity
- The entity to check.- Returns:
- True if the components are the same, false otherwise.
-
entityCheck
protected void entityCheck(com.badlogic.ashley.core.Entity entity) Description copied from class:AbstractView
Checks whether the given entity is suitable for this view. This method should throw aRuntimeException
if the entity is not suitable.- Specified by:
entityCheck
in classAbstractView
- Parameters:
entity
- The entity.
-
entityChanged
protected void entityChanged()Description copied from class:AbstractView
Contains actions to take after a new entity has been set. This method is typically used to initialize the view components.- Specified by:
entityChanged
in classAbstractView
-
entityCleared
protected void entityCleared()Description copied from class:AbstractView
This method is called when the entity of this view is cleared. It should set all component references to null.- Specified by:
entityCleared
in classAbstractView
-
getPosition
- Specified by:
getPosition
in interfaceIPosition
-
getVelocity
- Specified by:
getVelocity
in interfaceIPosition
-