ecs v0.2.1 ECS.Entity
Functions to work with entities.
An entity is an agent-based container for a map of components.
Examples
# Create a monster entity.
monster = ECS.Entity.new([
Component.Health.new(100),
Component.Name.new("monster")
])
# Output its name.
IO.puts ECS.Entity.get(monster, :name) # "monster"
# Attach an attack component to the monster.
ECS.Entity.attach(monster, Component.Attack.new(:melee, 24))
Summary
Functions
Attaches a component
to an entity
Detaches a component of type cmp_type
from an entity
Retrieves a component’s value of type cmp_type
from an entity
Checks whether an entity
has component(s) of cmp_type
Returns a new agent pid wrapping components
as a map
Sets entity
component of cmp_type
to value
Updates entity
’s component value of cmp_type
using update_fn