module Entitas::IEntity

Direct including types

Defined in:

entitas/interfaces/i_entity.cr

Constant Summary

Log = ::Log.for(self)

Instance Method Summary

Instance Method Detail

abstract def add_component(index : Int32, component : Entitas::IComponent) #

[View source]
def add_component(index : Entitas::Component::Index, component : Entitas::IComponent) : Entitas::IComponent #

[View source]
def add_component(component : Entitas::IComponent) : Entitas::IComponent #

[View source]
abstract def aerc : AERC #

[View source]
abstract def component_index(index) : Entitas::Component::Index #

[View source]
abstract def component_index_class(index) : Entitas::Component::ComponentTypes #

[View source]
abstract def component_index_value(index) : Int32 #

[View source]
abstract def component_pools : Array(Entitas::ComponentPool) #

[View source]
abstract def context_info : Entitas::Context::Info #

[View source]
def create_component(_type : Entitas::Component::ComponentTypes, **args) #

[View source]
abstract def create_component(index : Entitas::Component::Index, **args) #

[View source]
def creation_index : Int32 #

[View source]
abstract def destroy! : Nil #

[View source]
def enabled? #

The context manages the state of an entity. Active entities are enabled, destroyed entities are not.


[View source]
abstract def get_component(index : Int32) #

Will return the Entitas::Component at the provided index. You can only get a component at an index if it exists.


[View source]
def get_component(index : Entitas::Component::Index) : Entitas::IComponent #

[View source]
abstract def get_component_indices : Enumerable(Int32) #

Returns all indices of added components.


[View source]
abstract def get_components : Enumerable(Entitas::IComponent) #

[View source]
abstract def has_any_component?(indices : Enumerable(Int32)) : Bool #

Determines whether this entity has a component at any of the specified indices.


[View source]
abstract def has_component?(index : Int32) : Bool #

Determines whether this entity has a component at the specified index.


[View source]
def has_component?(index : Entitas::Component::Index) : Bool #

[View source]
abstract def has_components?(indices : Enumerable(Int32)) : Bool #

Determines whether this entity has components at all the specified indices.


[View source]
abstract def internal_destroy! #

This method is used internally. Don't call it yourself. use destroy


[View source]
def on_component_added(&block : Entitas::Events::OnComponentAdded -> Nil) #

Will append the &block to the #on_component_added_event_hooks array

on_component_added do |event|
  # do something with event
end

def on_component_added_event_hooks : Array(Proc(Entitas::Events::OnComponentAdded, Nil)) #

Array of event hooks to trigger when an Entitas::Events::OnComponentAdded is emitted


def on_component_removed(&block : Entitas::Events::OnComponentRemoved -> Nil) #

Will append the &block to the #on_component_removed_event_hooks array

on_component_removed do |event|
  # do something with event
end

def on_component_removed_event_hooks : Array(Proc(Entitas::Events::OnComponentRemoved, Nil)) #

Array of event hooks to trigger when an Entitas::Events::OnComponentRemoved is emitted


def on_component_replaced(&block : Entitas::Events::OnComponentReplaced -> Nil) #

Will append the &block to the #on_component_replaced_event_hooks array

on_component_replaced do |event|
  # do something with event
end

def on_component_replaced_event_hooks : Array(Proc(Entitas::Events::OnComponentReplaced, Nil)) #

Array of event hooks to trigger when an Entitas::Events::OnComponentReplaced is emitted


def on_destroy_entity(&block : Entitas::Events::OnDestroyEntity -> Nil) #

Will append the &block to the #on_destroy_entity_event_hooks array

on_destroy_entity do |event|
  # do something with event
end

def on_destroy_entity_event_hooks : Array(Proc(Entitas::Events::OnDestroyEntity, Nil)) #

Array of event hooks to trigger when an Entitas::Events::OnDestroyEntity is emitted


def on_entity_created(&block : Entitas::Events::OnEntityCreated -> Nil) #

Will append the &block to the #on_entity_created_event_hooks array

on_entity_created do |event|
  # do something with event
end

def on_entity_created_event_hooks : Array(Proc(Entitas::Events::OnEntityCreated, Nil)) #

Array of event hooks to trigger when an Entitas::Events::OnEntityCreated is emitted


def on_entity_destroyed(&block : Entitas::Events::OnEntityDestroyed -> Nil) #

Will append the &block to the #on_entity_destroyed_event_hooks array

on_entity_destroyed do |event|
  # do something with event
end

def on_entity_destroyed_event_hooks : Array(Proc(Entitas::Events::OnEntityDestroyed, Nil)) #

Array of event hooks to trigger when an Entitas::Events::OnEntityDestroyed is emitted


def on_entity_released(&block : Entitas::Events::OnEntityReleased -> Nil) #

Will append the &block to the #on_entity_released_event_hooks array

on_entity_released do |event|
  # do something with event
end

def on_entity_released_event_hooks : Array(Proc(Entitas::Events::OnEntityReleased, Nil)) #

Array of event hooks to trigger when an Entitas::Events::OnEntityReleased is emitted


def on_entity_will_be_destroyed(&block : Entitas::Events::OnEntityWillBeDestroyed -> Nil) #

Will append the &block to the #on_entity_will_be_destroyed_event_hooks array

on_entity_will_be_destroyed do |event|
  # do something with event
end

def on_entity_will_be_destroyed_event_hooks : Array(Proc(Entitas::Events::OnEntityWillBeDestroyed, Nil)) #

Array of event hooks to trigger when an Entitas::Events::OnEntityWillBeDestroyed is emitted


def on_group_created(&block : Entitas::Events::OnGroupCreated -> Nil) #

Will append the &block to the #on_group_created_event_hooks array

on_group_created do |event|
  # do something with event
end

def on_group_created_event_hooks : Array(Proc(Entitas::Events::OnGroupCreated, Nil)) #

Array of event hooks to trigger when an Entitas::Events::OnGroupCreated is emitted


abstract def reactivate(creation_index : Int32, context_info : Entitas::Context::Info) #

[View source]
abstract def reactivate(creation_index : Int32) #

[View source]
def receive_on_component_added_event(event : Entitas::Events::OnComponentAdded) #

def receive_on_component_removed_event(event : Entitas::Events::OnComponentRemoved) #

def receive_on_component_replaced_event(event : Entitas::Events::OnComponentReplaced) #

def receive_on_destroy_entity_event(event : Entitas::Events::OnDestroyEntity) #

def receive_on_entity_created_event(event : Entitas::Events::OnEntityCreated) #

def receive_on_entity_destroyed_event(event : Entitas::Events::OnEntityDestroyed) #

def receive_on_entity_released_event(event : Entitas::Events::OnEntityReleased) #

def receive_on_entity_will_be_destroyed_event(event : Entitas::Events::OnEntityWillBeDestroyed) #

def receive_on_group_created_event(event : Entitas::Events::OnGroupCreated) #

abstract def release(owner) #

[View source]
abstract def remove_all_components! : Nil #

Removes all components.


[View source]
abstract def remove_all_on_entity_released_handlers #

[View source]
abstract def remove_component(index : Int32) #

[View source]
def remove_component(index : Entitas::Component::Index) : Nil #

[View source]
def remove_on_component_added_hook(hook : Proc(Entitas::Events::OnComponentAdded, Nil)) #

def remove_on_component_removed_hook(hook : Proc(Entitas::Events::OnComponentRemoved, Nil)) #

def remove_on_component_replaced_hook(hook : Proc(Entitas::Events::OnComponentReplaced, Nil)) #

def remove_on_destroy_entity_hook(hook : Proc(Entitas::Events::OnDestroyEntity, Nil)) #

def remove_on_entity_created_hook(hook : Proc(Entitas::Events::OnEntityCreated, Nil)) #

def remove_on_entity_destroyed_hook(hook : Proc(Entitas::Events::OnEntityDestroyed, Nil)) #

def remove_on_entity_released_hook(hook : Proc(Entitas::Events::OnEntityReleased, Nil)) #

def remove_on_entity_will_be_destroyed_hook(hook : Proc(Entitas::Events::OnEntityWillBeDestroyed, Nil)) #

def remove_on_group_created_hook(hook : Proc(Entitas::Events::OnGroupCreated, Nil)) #

abstract def replace_component(index : Int32, component : Entitas::IComponent | Nil) #

[View source]
def replace_component(index : Entitas::Component::Index, component : Entitas::IComponent | Nil) #

[View source]
def replace_component(component : Entitas::IComponent | Nil) #

[View source]
abstract def retain_count : Int32 #

[View source]
abstract def retained_by?(owner) #

[View source]
def total_components : Int32 #

The total amount of components an entity can possibly have.


[View source]