Class Archetype
java.lang.Object
gaiasky.scene.Archetype
An archetype is a blueprint to build an object instance in the ECS. It maintains a set with the component classes
of the archetype and a reference to a possible parent.
-
Constructor Summary
ConstructorsConstructorDescriptionArchetype(com.badlogic.ashley.core.Engine engine, Archetype parent, String name, Class<? extends com.badlogic.ashley.core.Component>... componentClasses) Archetype(com.badlogic.ashley.core.Engine engine, String name, Class<? extends com.badlogic.ashley.core.Component>... componentClasses) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddComponentsRecursive(com.badlogic.ashley.core.Entity entity) com.badlogic.ashley.core.Entitycom.badlogic.ashley.core.FamilygetName()booleanhasComponent(com.badlogic.ashley.core.Component component) booleanmatches(com.badlogic.ashley.core.Entity entity) Checks whether the given entity matches this archetype.inttoString()
-
Constructor Details
-
Archetype
@SafeVarargs public Archetype(com.badlogic.ashley.core.Engine engine, Archetype parent, String name, Class<? extends com.badlogic.ashley.core.Component>... componentClasses) -
Archetype
@SafeVarargs public Archetype(com.badlogic.ashley.core.Engine engine, String name, Class<? extends com.badlogic.ashley.core.Component>... componentClasses)
-
-
Method Details
-
getFamily
public com.badlogic.ashley.core.Family getFamily() -
createEntity
public com.badlogic.ashley.core.Entity createEntity() -
addComponentsRecursive
public void addComponentsRecursive(com.badlogic.ashley.core.Entity entity) -
numComponents
public int numComponents() -
hasComponent
public boolean hasComponent(com.badlogic.ashley.core.Component component) -
matches
public boolean matches(com.badlogic.ashley.core.Entity entity) Checks whether the given entity matches this archetype.- Parameters:
entity- The entity.- Returns:
- True if the entity is of this archetype (has the same components), false otherwise.
-
getName
-
toString
-