Beispiel #1
0
 /// <summary>
 /// Frees an entity back to the agent's pool of available entities.
 /// Destroying an entity will also destroy any components attached to it.
 /// </summary>
 /// <param name="entity">The entity to destroy/free.</param>
 public void DestroyEntity(EcsEntity entity)
 {
     _componentGateway.EntityDestroyed(entity);
     _systemGateway.EntityDestroyed(entity);
     _entityGateway.DestroyEntity(entity);
 }
Beispiel #2
0
 /// <summary>
 /// Gets a component attached to the given entity.
 /// </summary>
 /// <typeparam name="T">The type of the component.</typeparam>
 /// <param name="entity">The entity that has the component added to it.</param>
 /// <returns>The instance of the component attached to the given entity.</returns>
 public T GetComponent <T>(EcsEntity entity)
 {
     return(_componentGateway.GetComponent <T>(entity));
 }
Beispiel #3
0
 /// <summary>
 /// Create a new ECS agent class.
 /// </summary>
 public EcsAgent()
 {
     _singletonEntity = _entityGateway.CreateEntity();
 }