Package com.tenio.engine.ecs.base
Interface IEntity
-
- All Known Implementing Classes:
Entity
public interface IEntity
An entity is something that exists in your game world. Again, an entity is little more than a list of components. Because they are so simple, most implementations won't define an entity as a concrete piece of data. Instead, an entity is a unique ID, and all components that make up an entity will be tagged with that ID.- Author:
- kong
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IComponent
getComponent(int index)
Retrieves the component by indexIElementPool<IComponent>[]
getComponentPools()
Retrieves the list of component poolsIComponent[]
getComponents()
Retrieves a list of the current entityContextInfo
getContextInfo()
Retrieves the context informationjava.lang.String
getId()
Retrieves the entity's idboolean
hasAnyComponent(int... indices)
Check if one of components in list are existed or notboolean
hasComponent(int index)
Check if the component is existed or notboolean
hasComponents(int... indices)
Check if all the components in list are existed or notvoid
removeAllComponents()
Remove all componentsvoid
removeComponent(int index)
Remove component by indexvoid
replaceComponent(int index, IComponent component)
Replace old component by new component by indexvoid
reset()
Reset entityvoid
setComponent(int index, IComponent component)
Set new componentvoid
setComponentPools(IElementPool<IComponent>[] __componentPools)
Set list of component pools, each component pool manages specific component typevoid
setContextInfo(ContextInfo contextInfo)
Set context informationvoid
setId(java.lang.String id)
Set new id
-
-
-
Method Detail
-
setId
void setId(java.lang.String id)
Set new id- Parameters:
id
- the desired id
-
getId
java.lang.String getId()
Retrieves the entity's id- Returns:
- entity's id
-
setContextInfo
void setContextInfo(ContextInfo contextInfo)
Set context information- Parameters:
contextInfo
- seeContextInfo
-
setComponentPools
void setComponentPools(IElementPool<IComponent>[] __componentPools)
Set list of component pools, each component pool manages specific component type- Parameters:
__componentPools
- an array ofComponentPool
-
getComponentPools
IElementPool<IComponent>[] getComponentPools()
Retrieves the list of component pools- Returns:
- an array of
ComponentPool
-
getContextInfo
ContextInfo getContextInfo()
Retrieves the context information- Returns:
- see
ContextInfo
-
setComponent
void setComponent(int index, IComponent component)
Set new component- Parameters:
index
- the component indexcomponent
- the component object
-
removeComponent
void removeComponent(int index)
Remove component by index- Parameters:
index
- the component index
-
replaceComponent
void replaceComponent(int index, IComponent component)
Replace old component by new component by index- Parameters:
index
- the component indexcomponent
- the component object
-
getComponent
IComponent getComponent(int index)
Retrieves the component by index- Parameters:
index
- the component index- Returns:
- the corresponding component
-
getComponents
IComponent[] getComponents()
Retrieves a list of the current entity- Returns:
- list of components
-
hasComponent
boolean hasComponent(int index)
Check if the component is existed or not- Parameters:
index
- component index- Returns:
- true if the component is existed, false otherwise
-
hasComponents
boolean hasComponents(int... indices)
Check if all the components in list are existed or not- Parameters:
indices
- list of component indices- Returns:
- true if the all components are existed, false otherwise
-
hasAnyComponent
boolean hasAnyComponent(int... indices)
Check if one of components in list are existed or not- Parameters:
indices
- list of component indices- Returns:
- true if the one of components in list is existed, false otherwise
-
removeAllComponents
void removeAllComponents()
Remove all components
-
reset
void reset()
Reset entity
-
-