Entitas  0.40.0
Entitas is a super fast Entity Component System (ECS) Framework specifically made for C# and Unity
IContext.cs
1 using System.Collections.Generic;
2 
3 namespace Entitas {
4 
5  public delegate void ContextEntityChanged(IContext context, IEntity entity);
6  public delegate void ContextGroupChanged(IContext context, IGroup group);
7 
8  public interface IContext {
9 
10  event ContextEntityChanged OnEntityCreated;
11  event ContextEntityChanged OnEntityWillBeDestroyed;
12  event ContextEntityChanged OnEntityDestroyed;
13 
14  event ContextGroupChanged OnGroupCreated;
15  event ContextGroupChanged OnGroupCleared;
16 
17  int totalComponents { get; }
18 
19  Stack<IComponent>[] componentPools { get; }
20  ContextInfo contextInfo { get; }
21 
22  int count { get; }
23  int reusableEntitiesCount { get; }
24  int retainedEntitiesCount { get; }
25 
26  void DestroyAllEntities();
27 
28  void ClearGroups();
29 
30  void AddEntityIndex(IEntityIndex entityIndex);
31  IEntityIndex GetEntityIndex(string name);
32  void DeactivateAndRemoveEntityIndices();
33 
34  void ResetCreationIndex();
35  void ClearComponentPool(int index);
36  void ClearComponentPools();
37  void Reset();
38  }
39 
40  public interface IContext<TEntity> : IContext where TEntity : class, IEntity, new() {
41 
42  TEntity CreateEntity();
43  void DestroyEntity(TEntity entity);
44  bool HasEntity(TEntity entity);
45  TEntity[] GetEntities();
46 
47  IGroup<TEntity> GetGroup(IMatcher<TEntity> matcher);
48  }
49 }