struct ECS::Entity
 
  - ECS::Entity
- Struct
- Value
- Object
Overview
Сontainer for components. Consists from UInt64 and pointer to World
Defined in:
myecs.crInstance Method Summary
- 
        #add(comp : Component)
        
          Adds component to the entity. 
- 
        #destroy
        
          Destroys entity removing all components from it. 
- 
        #destroy_if_empty
        
          Destroys entity if it is empty. 
- 
        #has?(typ : ComponentType)
        
          Returns true if component of type typexists on the entity
- 
        #id : EntityID
        
          ID of entity 
- #inspect(io)
- 
        #remove(typ : ComponentType)
        
          Removes component of type typfrom the entity.
- 
        #remove_if_present(typ : ComponentType)
        
          Removes component of type typfrom the entity if it exists.
- 
        #replace(typ : ComponentType, comp : Component)
        
          Deletes component of type typand add componentcompto the entity
- 
        #set(comp : Component)
        
          Adds component to the entity or update existing component of same type 
- 
        #update(comp : Component)
        
          Update existing component of same type on the entity. 
- 
        #world : World
        
          World that contains entity 
Instance Method Detail
Adds component to the entity.
Will raise if component already exists (and doesn't have MultipleComponents annotation)
Destroys entity removing all components from it. Entity ID is marked as free and can be reused
Destroys entity if it is empty. It is done automatically when last component is removed So the only use case is when you create entity then want to destroy if no components was added to it.
Removes component of type typ from the entity. Will raise if component isn't present on entity
Removes component of type typ from the entity if it exists. Otherwise, do nothing
Deletes component of type typ and add component comp to the entity
Adds component to the entity or update existing component of same type
Update existing component of same type on the entity. Will raise if component of this type isn't present.