Search Results for

    Show / Hide Table of Contents

    Class EntityManager

    Collects every Entity instance present in a Scene. As a collection, it supports common operations like adding and removing entities.

    Inheritance
    object
    IdentifiableObject
    DependencyObject
    AttachableObject
    SceneManager
    EntityManager
    Implements
    IDependencyObject
    Inherited Members
    SceneManager.Managers
    SceneManager.Scene
    SceneManager.OnLoaded()
    SceneManager.OnAttached()
    SceneManager.OnDeactivated()
    SceneManager.OnDestroy()
    AttachableObject.AttachableStateChanged
    AttachableObject.IsEnabled
    AttachableObject.State
    AttachableObject.IsLoaded
    AttachableObject.IsAttached
    AttachableObject.IsActivated
    AttachableObject.IsStarted
    AttachableObject.IsDestroyed
    AttachableObject.ShouldBeActivated
    AttachableObject.Destroy()
    AttachableObject.DependencyBroken()
    DependencyObject.Dependencies
    DependencyObject.OnDependencyRemoved
    IdentifiableObject.Id
    IdentifiableObject.IdHasChanged(Guid)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Evergine.Framework.Managers
    Assembly: Evergine.Framework.dll
    Syntax
    public class EntityManager : SceneManager, IDependencyObject

    Constructors

    EntityManager()

    Initializes a new instance of the EntityManager class.

    Declaration
    public EntityManager()
    Exceptions
    Type Condition
    ArgumentNullException

    If adapter or scene are null.

    Properties

    AllEntities

    Gets every Entity instance. The is gone through every Entity including its children.

    Declaration
    public IEnumerable<Entity> AllEntities { get; }
    Property Value
    Type Description
    IEnumerable<Entity>

    Every Entity instance.

    Exceptions
    Type Condition
    ObjectDisposedException

    EntityManager has been disposed.

    Count

    Gets how many Entity instances are added to this instance.

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    int

    How many Entity instances are added to this instance.

    EntityGraph

    Gets the Entity instances (see if you prefer a collection of object). IMPORTANT NOTE: Just the parents are contained within the returning value (i.e. just the instances subject to an Add() call). Children will not be considered here. See if you are looking also for children.

    Declaration
    public IEnumerable<Entity> EntityGraph { get; }
    Property Value
    Type Description
    IEnumerable<Entity>

    The Entity instances.

    Exceptions
    Type Condition
    ObjectDisposedException

    EntityManager has been disposed.

    Methods

    Add(Entity)

    Adds a new Entity to this instance.

    Declaration
    public virtual void Add(Entity entity)
    Parameters
    Type Name Description
    Entity entity

    The Entity to add.

    Exceptions
    Type Condition
    ArgumentNullException

    If entity is null.

    InvalidOperationException

    If there is already an entity added to this instance with the same name.

    Add(IEnumerable<Entity>)

    Adds a list of Entity to EntityManager.

    Declaration
    public virtual void Add(IEnumerable<Entity> newEntities)
    Parameters
    Type Name Description
    IEnumerable<Entity> newEntities

    The Entity list to add.

    Exceptions
    Type Condition
    ArgumentNullException

    If entity is null.

    InvalidOperationException

    If there is already an entity added to this instance with the same name.

    Contains(Entity)

    Determines whether this instance contains the specified Entity through its property.

    Declaration
    public bool Contains(Entity entity)
    Parameters
    Type Name Description
    Entity entity

    The Entity to check.

    Returns
    Type Description
    bool

    true if this instance contains the specified Entity; otherwise, false.

    Exceptions
    Type Condition
    ArgumentNullException

    If entity is null.

    Detach(Entity)

    Detach a specific entity.

    Declaration
    public bool Detach(Entity entity)
    Parameters
    Type Name Description
    Entity entity

    The entity to detach.

    Returns
    Type Description
    bool

    Whether an entity was detached.

    Remarks

    The entity is disposed when it is detached from this instance.

    Exceptions
    Type Condition
    ArgumentNullException

    If entity is null.

    Find(Guid)

    Looks for an Entity entity in the , through its name.

    Declaration
    public Entity Find(Guid entityId)
    Parameters
    Type Name Description
    Guid entityId

    The entity Id to find.

    Returns
    Type Description
    Entity

    The Entity with the specified entityId, or null if no entity was found.

    Exceptions
    Type Condition
    ArgumentNullException

    If the entity id is an empty Guid.

    Find(string, Entity)

    Find the first entity in the EntityGraph with the given entity path.

    Declaration
    public Entity Find(string entityPath, Entity sourceEntity = null)
    Parameters
    Type Name Description
    string entityPath

    Path of the entity to look for. If sourceEntity is not null, the path is relative to that.

    Entity sourceEntity

    The source entity for a relative path.

    Returns
    Type Description
    Entity

    The Entity with the specified entityPath, or null if no entity was found.

    Exceptions
    Type Condition
    ArgumentNullException

    If name is null or empty.

    FindAllByTag(string)

    Finds all entities with the same tag in the .

    Declaration
    public IEnumerable<Entity> FindAllByTag(string tag)
    Parameters
    Type Name Description
    string tag

    The tag.

    Returns
    Type Description
    IEnumerable<Entity>

    All entities with the same tag in the .

    FindComponentFromEntityPath<T>(string, bool)

    Return the first component inside of the first entity with the given entity path.

    Declaration
    public T FindComponentFromEntityPath<T>(string entityPath, bool isExactType = true) where T : Component
    Parameters
    Type Name Description
    string entityPath

    Entity Path.

    bool isExactType

    if set to true [is exact type].

    Returns
    Type Description
    T

    Component inside of entity.

    Type Parameters
    Name Description
    T

    Component Type.

    FindComponentsFromEntityPath<T>(string, bool)

    Return the components inside of the first entity with the given entity path.

    Declaration
    public IEnumerable<T> FindComponentsFromEntityPath<T>(string entityPath, bool isExactType = true) where T : Component
    Parameters
    Type Name Description
    string entityPath

    Entity Path.

    bool isExactType

    if set to true [is exact type].

    Returns
    Type Description
    IEnumerable<T>

    Components collection.

    Type Parameters
    Name Description
    T

    Component Type.

    FindComponentsOfType(Type, bool, string)

    Iterate through the entire entity hierarchy and return all component instances of the specified type.

    Declaration
    public IEnumerable<Component> FindComponentsOfType(Type type, bool isExactType = true, string tag = null)
    Parameters
    Type Name Description
    Type type

    The component type.

    bool isExactType

    Whether to match the exact type.

    string tag

    Filter entities by this tag.

    Returns
    Type Description
    IEnumerable<Component>

    The component enumerable.

    Remarks

    This method is extremely low, try to not use inside an Update method.

    FindComponentsOfType<T>(bool, string)

    Iterate through the entire entity hierarchy and return all component instances of the specified type.

    Declaration
    public IEnumerable<T> FindComponentsOfType<T>(bool isExactType = true, string tag = null) where T : Component
    Parameters
    Type Name Description
    bool isExactType

    Whether to match the exact type.

    string tag

    Filter entities by this tag.

    Returns
    Type Description
    IEnumerable<T>

    The component enumerable.

    Type Parameters
    Name Description
    T

    The component type.

    Remarks

    This method is extremely low, try to not use inside an Update method.

    FindFirstComponentOfType(Type, bool, string)

    Iterate through the entire entity hierarchy and return the first component instance of the specified type.

    Declaration
    public Component FindFirstComponentOfType(Type type, bool isExactType = true, string tag = null)
    Parameters
    Type Name Description
    Type type

    The component type.

    bool isExactType

    Whether to match the exact type.

    string tag

    Filter entities by this tag.

    Returns
    Type Description
    Component

    The component.

    Remarks

    This method is extremely low, try to not use inside an Update method.

    FindFirstComponentOfType<T>(bool, string)

    Iterate through the entire entity hierarchy and return the first component instance of the specified type.

    Declaration
    public T FindFirstComponentOfType<T>(bool isExactType = true, string tag = null) where T : Component
    Parameters
    Type Name Description
    bool isExactType

    if set to true [is exact type].

    string tag

    Filter entities by this tag.

    Returns
    Type Description
    T

    The component.

    Type Parameters
    Name Description
    T

    The component type.

    Remarks

    This method is extremely low, try to not use inside an Update method.

    GetEntityTagCollection(string)

    Gets a collection of entities filtered by the specified tag.

    Declaration
    public virtual EntityManager.EntityTagCollection GetEntityTagCollection(string tag)
    Parameters
    Type Name Description
    string tag

    The tag.

    Returns
    Type Description
    EntityManager.EntityTagCollection

    The entity tag collection instance.

    OnActivated()

    Invoked when the object is activated once is attached.

    Declaration
    protected override void OnActivated()
    Overrides
    SceneManager.OnActivated()

    OnDetach()

    Invoked when the object is detached.

    Declaration
    protected override void OnDetach()
    Overrides
    SceneManager.OnDetach()

    Remove(Entity)

    Removes a specific entity.

    Declaration
    public virtual bool Remove(Entity entity)
    Parameters
    Type Name Description
    Entity entity

    The entity to remove.

    Returns
    Type Description
    bool

    Whether an entity was removed.

    Remarks

    The entity is disposed when it is removed from this instance.

    Exceptions
    Type Condition
    ArgumentNullException

    If entity is null.

    Start()

    Invoked to start the object.

    Declaration
    protected override void Start()
    Overrides
    SceneManager.Start()

    Events

    EntityAdded

    Occurs when an Entity is added.

    Declaration
    public event EventHandler<Entity> EntityAdded
    Event Type
    Type Description
    EventHandler<Entity>

    EntityDetached

    Occurs when an Entity is detached.

    Notice that even when removing an entity, the entity is detached first. So this event will be fired for removed entities too.

    Declaration
    public event EventHandler<Entity> EntityDetached
    Event Type
    Type Description
    EventHandler<Entity>

    Implements

    IDependencyObject

    Extension Methods

    EntityHierarchyExtensions.MoveEntityAfter(EntityManager, Guid, Guid?)
    EntityHierarchyExtensions.MoveEntityBefore(EntityManager, Guid, Guid?)
    ReflectionHelper.GetMemberAssembly(object)
    ReflectionHelper.GetTypeName(object)
    In This Article
    Back to top
    Generated by DocFX