using System.Collections.Generic; using EcsRx.Blueprints; using EcsRx.Entities; namespace EcsRx.Collections.Entity { /// /// The entity collection is a container for entities, it can be seen as a Repository of sorts /// as it allows for CRUD based operations and querying (through extensions) /// public interface IEntityCollection : IReadOnlyList, INotifyingEntityCollection { /// /// Name of the collection /// int Id { get; } /// /// This will create and return a new entity. /// If required you can pass in a blueprint which the created entity will conform to /// /// Optional blueprint to use for the entity (defaults to null) /// IEntity CreateEntity(IBlueprint blueprint = null); /// /// This will add an existing entity into the group, it is mainly used for pre-made /// entities which have been created from persisted data/serializers etc. /// Should be used with care as you should only have an entity in one collection. /// /// Entity to add to the collection void AddEntity(IEntity entity); /// /// Gets the entity from the collection, this will return the IEntity or null /// /// The Id of the entity you want to locate /// The entity that has been located or null if one could not be found IEntity GetEntity(int id); /// /// Checks if the collection contains a given entity /// /// The Id of the entity you want to locate /// true if it finds the entity, false if it cannot bool ContainsEntity(int id); /// /// This will remove the entity from the collection and optionally destroy the entity. /// It is worth noting if you try to remove an entity id that does not exist you will get an exception /// /// The Id of the entity you want to remove /// If the entity should be disposed when removed (defaults to true) void RemoveEntity(int id, bool disposeOnRemoval = true); } }