module Entitas::IEntity
Direct including types
Defined in:
entitas/interfaces/i_entity.crConstant Summary
-
Log =
::Log.for(self)
Instance Method Summary
- #add_component(index : Int32, component : Entitas::IComponent)
- #add_component(index : Entitas::Component::Index, component : Entitas::IComponent) : Entitas::IComponent
- #add_component(component : Entitas::IComponent) : Entitas::IComponent
- #aerc : AERC
- #component_index(index) : Entitas::Component::Index
- #component_index_class(index) : Entitas::Component::ComponentTypes
- #component_index_value(index) : Int32
- #component_pools : Array(Entitas::ComponentPool)
- #context_info : Entitas::Context::Info
- #create_component(_type : Entitas::Component::ComponentTypes, **args)
- #create_component(index : Entitas::Component::Index, **args)
- #creation_index : Int32
- #destroy! : Nil
-
#enabled?
The context manages the state of an entity.
-
#get_component(index : Int32)
Will return the
Entitas::Component
at the provided index. - #get_component(index : Entitas::Component::Index) : Entitas::IComponent
-
#get_component_indices : Enumerable(Int32)
Returns all indices of added components.
- #get_components : Enumerable(Entitas::IComponent)
-
#has_any_component?(indices : Enumerable(Int32)) : Bool
Determines whether this entity has a component at any of the specified indices.
-
#has_component?(index : Int32) : Bool
Determines whether this entity has a component at the specified index.
- #has_component?(index : Entitas::Component::Index) : Bool
-
#has_components?(indices : Enumerable(Int32)) : Bool
Determines whether this entity has components at all the specified indices.
-
#internal_destroy!
This method is used internally.
-
#on_component_added(&block : Entitas::Events::OnComponentAdded -> Nil)
Will append the
&block
to the#on_component_added_event_hooks
array -
#on_component_added_event_hooks : Array(Proc(Entitas::Events::OnComponentAdded, Nil))
Array of event hooks to trigger when an
Entitas::Events::OnComponentAdded
is emitted -
#on_component_removed(&block : Entitas::Events::OnComponentRemoved -> Nil)
Will append the
&block
to the#on_component_removed_event_hooks
array -
#on_component_removed_event_hooks : Array(Proc(Entitas::Events::OnComponentRemoved, Nil))
Array of event hooks to trigger when an
Entitas::Events::OnComponentRemoved
is emitted -
#on_component_replaced(&block : Entitas::Events::OnComponentReplaced -> Nil)
Will append the
&block
to the#on_component_replaced_event_hooks
array -
#on_component_replaced_event_hooks : Array(Proc(Entitas::Events::OnComponentReplaced, Nil))
Array of event hooks to trigger when an
Entitas::Events::OnComponentReplaced
is emitted -
#on_destroy_entity(&block : Entitas::Events::OnDestroyEntity -> Nil)
Will append the
&block
to the#on_destroy_entity_event_hooks
array -
#on_destroy_entity_event_hooks : Array(Proc(Entitas::Events::OnDestroyEntity, Nil))
Array of event hooks to trigger when an
Entitas::Events::OnDestroyEntity
is emitted -
#on_entity_created(&block : Entitas::Events::OnEntityCreated -> Nil)
Will append the
&block
to the#on_entity_created_event_hooks
array -
#on_entity_created_event_hooks : Array(Proc(Entitas::Events::OnEntityCreated, Nil))
Array of event hooks to trigger when an
Entitas::Events::OnEntityCreated
is emitted -
#on_entity_destroyed(&block : Entitas::Events::OnEntityDestroyed -> Nil)
Will append the
&block
to the#on_entity_destroyed_event_hooks
array -
#on_entity_destroyed_event_hooks : Array(Proc(Entitas::Events::OnEntityDestroyed, Nil))
Array of event hooks to trigger when an
Entitas::Events::OnEntityDestroyed
is emitted -
#on_entity_released(&block : Entitas::Events::OnEntityReleased -> Nil)
Will append the
&block
to the#on_entity_released_event_hooks
array -
#on_entity_released_event_hooks : Array(Proc(Entitas::Events::OnEntityReleased, Nil))
Array of event hooks to trigger when an
Entitas::Events::OnEntityReleased
is emitted -
#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_event_hooks : Array(Proc(Entitas::Events::OnEntityWillBeDestroyed, Nil))
Array of event hooks to trigger when an
Entitas::Events::OnEntityWillBeDestroyed
is emitted -
#on_group_created(&block : Entitas::Events::OnGroupCreated -> Nil)
Will append the
&block
to the#on_group_created_event_hooks
array -
#on_group_created_event_hooks : Array(Proc(Entitas::Events::OnGroupCreated, Nil))
Array of event hooks to trigger when an
Entitas::Events::OnGroupCreated
is emitted - #reactivate(creation_index : Int32, context_info : Entitas::Context::Info)
- #reactivate(creation_index : Int32)
- #receive_on_component_added_event(event : Entitas::Events::OnComponentAdded)
- #receive_on_component_removed_event(event : Entitas::Events::OnComponentRemoved)
- #receive_on_component_replaced_event(event : Entitas::Events::OnComponentReplaced)
- #receive_on_destroy_entity_event(event : Entitas::Events::OnDestroyEntity)
- #receive_on_entity_created_event(event : Entitas::Events::OnEntityCreated)
- #receive_on_entity_destroyed_event(event : Entitas::Events::OnEntityDestroyed)
- #receive_on_entity_released_event(event : Entitas::Events::OnEntityReleased)
- #receive_on_entity_will_be_destroyed_event(event : Entitas::Events::OnEntityWillBeDestroyed)
- #receive_on_group_created_event(event : Entitas::Events::OnGroupCreated)
- #release(owner)
-
#remove_all_components! : Nil
Removes all components.
- #remove_all_on_entity_released_handlers
- #remove_component(index : Int32)
- #remove_component(index : Entitas::Component::Index) : Nil
- #remove_on_component_added_hook(hook : Proc(Entitas::Events::OnComponentAdded, Nil))
- #remove_on_component_removed_hook(hook : Proc(Entitas::Events::OnComponentRemoved, Nil))
- #remove_on_component_replaced_hook(hook : Proc(Entitas::Events::OnComponentReplaced, Nil))
- #remove_on_destroy_entity_hook(hook : Proc(Entitas::Events::OnDestroyEntity, Nil))
- #remove_on_entity_created_hook(hook : Proc(Entitas::Events::OnEntityCreated, Nil))
- #remove_on_entity_destroyed_hook(hook : Proc(Entitas::Events::OnEntityDestroyed, Nil))
- #remove_on_entity_released_hook(hook : Proc(Entitas::Events::OnEntityReleased, Nil))
- #remove_on_entity_will_be_destroyed_hook(hook : Proc(Entitas::Events::OnEntityWillBeDestroyed, Nil))
- #remove_on_group_created_hook(hook : Proc(Entitas::Events::OnGroupCreated, Nil))
- #replace_component(index : Int32, component : Entitas::IComponent | Nil)
- #replace_component(index : Entitas::Component::Index, component : Entitas::IComponent | Nil)
- #replace_component(component : Entitas::IComponent | Nil)
- #retain_count : Int32
- #retained_by?(owner)
-
#total_components : Int32
The total amount of components an entity can possibly have.
Instance Method Detail
The context manages the state of an entity. Active entities are enabled, destroyed entities are not.
Will return the Entitas::Component
at the provided index.
You can only get a component at an index if it exists.
Determines whether this entity has a component at any of the specified indices.
Determines whether this entity has a component at the specified index.
Determines whether this entity has components at all the specified indices.
This method is used internally. Don't call it yourself. use destroy
Will append the &block
to the #on_component_added_event_hooks
array
on_component_added do |event|
# do something with event
end
Array of event hooks to trigger when an Entitas::Events::OnComponentAdded
is emitted
Will append the &block
to the #on_component_removed_event_hooks
array
on_component_removed do |event|
# do something with event
end
Array of event hooks to trigger when an Entitas::Events::OnComponentRemoved
is emitted
Will append the &block
to the #on_component_replaced_event_hooks
array
on_component_replaced do |event|
# do something with event
end
Array of event hooks to trigger when an Entitas::Events::OnComponentReplaced
is emitted
Will append the &block
to the #on_destroy_entity_event_hooks
array
on_destroy_entity do |event|
# do something with event
end
Array of event hooks to trigger when an Entitas::Events::OnDestroyEntity
is emitted
Will append the &block
to the #on_entity_created_event_hooks
array
on_entity_created do |event|
# do something with event
end
Array of event hooks to trigger when an Entitas::Events::OnEntityCreated
is emitted
Will append the &block
to the #on_entity_destroyed_event_hooks
array
on_entity_destroyed do |event|
# do something with event
end
Array of event hooks to trigger when an Entitas::Events::OnEntityDestroyed
is emitted
Will append the &block
to the #on_entity_released_event_hooks
array
on_entity_released do |event|
# do something with event
end
Array of event hooks to trigger when an Entitas::Events::OnEntityReleased
is emitted
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
Array of event hooks to trigger when an Entitas::Events::OnEntityWillBeDestroyed
is emitted
Will append the &block
to the #on_group_created_event_hooks
array
on_group_created do |event|
# do something with event
end
Array of event hooks to trigger when an Entitas::Events::OnGroupCreated
is emitted