Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    EntityManager Class

    Namespace: Stride.Engine
    Assembly: Stride.Engine.dll

    Manage a collection of entities.

    System.Object → DisposeBase → ComponentBase → EntityManager
    Derived from EntityManager: SceneInstance

    public abstract class EntityManager : ComponentBase, IDisposable, IComponent, IReferencable, ICollectorHolder, IReadOnlySet<Entity>, IReadOnlyCollection<Entity>, IEnumerable<Entity>, IEnumerable
    Name Description
    Constructors
    EntityManager(IServiceRegistry)

    Initializes a new instance of the EntityManager class.

    Properties
    ComponentTypes

    Gets the list of component types from the entities..

    Count
    ExecutionMode
    Processors

    Gets the entity Processors.

    Services

    Gets the services.

    Methods
    Contains(Entity)

    Determines whether this instance contains the specified entity.

    Draw(RenderContext)

    Calls Draw(RenderContext) on all enabled entity processors.

    GetEnumerator()

    Gets the Entity enumerator of this instance.

    GetProcessor<TProcessor>()

    Gets the first processor of the type TProcessor.

    OnComponentChanged(Entity, Int32, EntityComponent, EntityComponent)
    OnComponentTypeAdded(TypeInfo)
    OnEntityAdded(Entity)
    OnEntityRemoved(Entity)
    Remove(Entity)

    Removes the entity from the EntityManager. It works weither entity has a parent or not. In conjonction with , it will remove child entities as well.

    Reset()

    Removes all entities from the EntityManager.

    Update(GameTime)
    Events
    ComponentChanged

    Occurs when a component changed for an entity (Added or removed)

    ComponentTypeAdded

    Occurs when a new component type is added.

    EntityAdded

    Occurs when an entity is added.

    EntityRemoved

    Occurs when an entity is removed.

    HierarchyChanged

    Occurs when an entity is removed.

    Explicit Interface Implementations
    IEnumerable<Entity>.GetEnumerator()
    IEnumerable.GetEnumerator()
    | Improve this Doc View Source

    Constructors


    EntityManager(IServiceRegistry)

    Initializes a new instance of the EntityManager class.

    protected EntityManager(IServiceRegistry registry)
    Parameters
    Type Name Description
    IServiceRegistry registry

    The registry.

    Exceptions
    Type Condition
    System.ArgumentNullException

    registry

    | Improve this Doc View Source

    Properties


    ComponentTypes

    Gets the list of component types from the entities..

    public IEnumerable<TypeInfo> ComponentTypes { get; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<System.Reflection.TypeInfo>

    The registered component types.


    Count

    public int Count { get; }
    Property Value
    Type Description
    System.Int32

    ExecutionMode

    public ExecutionMode ExecutionMode { get; protected set; }
    Property Value
    Type Description
    ExecutionMode

    Processors

    Gets the entity Processors.

    public EntityProcessorCollection Processors { get; }
    Property Value
    Type Description
    EntityProcessorCollection

    Services

    Gets the services.

    public IServiceRegistry Services { get; }
    Property Value
    Type Description
    IServiceRegistry

    The services.

    | Improve this Doc View Source

    Methods


    Contains(Entity)

    Determines whether this instance contains the specified entity.

    public bool Contains(Entity item)
    Parameters
    Type Name Description
    Entity item

    The item.

    Returns
    Type Description
    System.Boolean

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


    Draw(RenderContext)

    Calls Draw(RenderContext) on all enabled entity processors.

    public virtual void Draw(RenderContext context)
    Parameters
    Type Name Description
    RenderContext context

    The render context.


    GetEnumerator()

    Gets the Entity enumerator of this instance.

    public HashSet<Entity>.Enumerator GetEnumerator()
    Returns
    Type Description
    System.Collections.Generic.HashSet.Enumerator<>

    The entity enumerator


    GetProcessor<TProcessor>()

    Gets the first processor of the type TProcessor.

    public TProcessor GetProcessor<TProcessor>()
        where TProcessor : EntityProcessor
    Returns
    Type Description
    TProcessor

    The first processor of type T or null if not found.

    Type Parameters
    Name Description
    TProcessor

    Type of the processor


    OnComponentChanged(Entity, Int32, EntityComponent, EntityComponent)

    protected virtual void OnComponentChanged(Entity entity, int index, EntityComponent previousComponent, EntityComponent newComponent)
    Parameters
    Type Name Description
    Entity entity
    System.Int32 index
    EntityComponent previousComponent
    EntityComponent newComponent

    OnComponentTypeAdded(TypeInfo)

    protected virtual void OnComponentTypeAdded(TypeInfo obj)
    Parameters
    Type Name Description
    System.Reflection.TypeInfo obj

    OnEntityAdded(Entity)

    protected virtual void OnEntityAdded(Entity e)
    Parameters
    Type Name Description
    Entity e

    OnEntityRemoved(Entity)

    protected virtual void OnEntityRemoved(Entity e)
    Parameters
    Type Name Description
    Entity e

    Remove(Entity)

    Removes the entity from the EntityManager. It works weither entity has a parent or not. In conjonction with , it will remove child entities as well.

    public void Remove(Entity entity)
    Parameters
    Type Name Description
    Entity entity

    The entity.


    Reset()

    Removes all entities from the EntityManager.

    protected virtual void Reset()

    Update(GameTime)

    public virtual void Update(GameTime gameTime)
    Parameters
    Type Name Description
    GameTime gameTime
    | Improve this Doc View Source

    Events


    ComponentChanged

    Occurs when a component changed for an entity (Added or removed)

    public event EventHandler<EntityComponentEventArgs> ComponentChanged
    Event Type
    Type Description
    System.EventHandler<EntityComponentEventArgs>

    ComponentTypeAdded

    Occurs when a new component type is added.

    public event EventHandler<TypeInfo> ComponentTypeAdded
    Event Type
    Type Description
    System.EventHandler<System.Reflection.TypeInfo>

    EntityAdded

    Occurs when an entity is added.

    public event EventHandler<Entity> EntityAdded
    Event Type
    Type Description
    System.EventHandler<Entity>

    EntityRemoved

    Occurs when an entity is removed.

    public event EventHandler<Entity> EntityRemoved
    Event Type
    Type Description
    System.EventHandler<Entity>

    HierarchyChanged

    Occurs when an entity is removed.

    public event EventHandler<Entity> HierarchyChanged
    Event Type
    Type Description
    System.EventHandler<Entity>
    | Improve this Doc View Source

    Explicit Interface Implementations


    IEnumerable<Entity>.GetEnumerator()

    IEnumerator<Entity> IEnumerable<Entity>.GetEnumerator()
    Returns
    Type Description
    System.Collections.Generic.IEnumerator<Entity>

    IEnumerable.GetEnumerator()

    IEnumerator IEnumerable.GetEnumerator()
    Returns
    Type Description
    System.Collections.IEnumerator

    Inherited Members

    ComponentBase.Tags
    ComponentBase.Name
    ComponentBase.Destroy()
    ComponentBase.ICollectorHolder.Collector
    ComponentBase.OnNameChanged()
    ComponentBase.ToString()
    DisposeBase.Dispose()
    DisposeBase.IsDisposed
    DisposeBase.IReferencable.ReferenceCount
    DisposeBase.IReferencable.AddReference()
    DisposeBase.IReferencable.Release()
    DisposeBase.OnAddReference()
    DisposeBase.OnReleaseReference()

    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    EnumerableExtensions.IsNullOrEmpty(IEnumerable)
    EnumerableExtensions.ForEach<T>(IEnumerable, Action<T>)
    EnumerableExtensions.ForEach<T>(IEnumerable<T>, Action<T>)
    EnumerableExtensions.IndexOf<T>(IEnumerable<T>, Func<T, Boolean>)
    EnumerableExtensions.LastIndexOf<T>(IEnumerable<T>, Func<T, Boolean>)
    EnumerableExtensions.NotNull<T>(IEnumerable<T>)
    EnumerableExtensions.ToHashCode<T>(IEnumerable<T>)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation