Skip to content

KECS / com.juanmedina.kecs.entity / Entity

Entity

class Entity

An Entity represent a instance of an object in our world.

An entity has a set of components, that are just simple data objects tha has the values for our entity.

Constructors

Name Summary
<init> An Entity represent a instance of an object in our world.Entity()

Properties

Name Summary
components The components that this entity hasval components:HashMap<KClass<*>,Any>

Functions

Name Summary
add Add a component to this entity.infix fun <T :Any> add(component: T):Unit
get Gets a component from the entity of the given type.fun <T :Any> get(): T
hasComponent Checks if an entity contains a component of the given type.fun <T :Any> hasComponent():Boolean
Checks if an entity contains a components of the given KClass.fun <T :Any> hasComponent(type:KClass<out T>):Boolean
hasComponents Checks if an entity contains a set of components of the given KClass.fun hasComponents(vararg types:KClass<outAny>):Boolean
isEmpty Checks if a entity is empty, so it has not component.fun isEmpty():Boolean
pair Creates a Pair from two components types.fun <T :Any, K :Any> pair():Pair<T, K>
removeComponent Removes a component of the given type from this entity.fun <T :Any> removeComponent():Unit
Removes a component of from this entity giving the component reference.fun <T :Any> removeComponent(component: T):Unit
set Sets the value component in this entity.fun <T :Any> set(component: T):Unit
toString Generates an String that represent the entity.fun toString():String
triple Creates a Triple from three components typesfun <T :Any, K :Any, V :Any> triple():Triple<T, K, V>