ecs v0.0.5 ECS.Service behaviour

Functions to setup and control services.

A service iterates over entities with certain components, and performs an action with them.

Examples

# Define a service to display entities' names.
defmodule Service.DisplayNames do
  # Accepts entities with a name component.
  def accepts?(entity) do
    ECS.Entity.has?(entity, :name)
  end

  # Displays the entity's name
  def perform(entity) do
    IO.puts ECS.Entity.get(entity, :name)
  end
end

Summary

Functions

Run service over entities

Functions

run(entities, list)

Run service over entities.

Callbacks

accepts?(pid)

Specs

accepts?(pid) :: Bool
perform(pid)

Specs

perform(pid) :: any