Package rosequartz.ecb
Class Entity
java.lang.Object
rosequartz.ecb.Entity
- All Implemented Interfaces:
Serializable
An ECB Entity.
Everything in your game is
represented by an Entity.
Entities hold components.
- See Also:
Component, Serialized Form
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds components to the entity.clear()Removes all components from the entity.copy()Clones / Copies this entity with all its components.<C extends Component>
CGets a component from the entity.Executes the given function if the entity has the given component of the exact same class, passing the component onto the function.getAll()Gets all components from the entity.<C extends Component>
booleanGets if the entity has a Component of the exact same class.Removes a Component from the entity.Removes a Component from the entity.
-
Constructor Details
-
Entity
public Entity()
-
-
Method Details
-
add
Adds components to the entity.- Parameters:
components- the components to add- Returns:
- this
-
has
Gets if the entity has a Component of the exact same class.- Parameters:
component- class of the component to check for- Returns:
- if the entity has all given components
-
remove
Removes a Component from the entity.- Parameters:
component- class of the component to remove- Returns:
- this
-
remove
Removes a Component from the entity.- Parameters:
component- component to remove- Returns:
- this
-
getAll
Gets all components from the entity.- Returns:
- all components
-
clear
Removes all components from the entity.- Returns:
- this
-
get
Gets a component from the entity.- Parameters:
component- the component to get- Returns:
- the component, null if not there
-
get
Executes the given function if the entity has the given component of the exact same class, passing the component onto the function.- Parameters:
component- class of the component to check foraction- function to execute with the component- Returns:
- this
-
copy
Clones / Copies this entity with all its components. Calls 'copy' for every component of the entity.- Returns:
- "copy" of this entity
-