Add a System, generally be called before EntityAdmin.start().
A system class. This class will not be instantiated, but EntityAdmin will call the system's static method Update().
Sometimes it may be necessary to traverse entities with some complex conditions. For example, you might want to traverse entities that have components A, B, C, but no components D, E, and have any one of G, F components. Lipstick-ecs provides the ability to traverse complex component combinations. Before this, should call the method AddWatchings() to specify the component combinations.
List of filters.
Delete all entities.
Delete an entity. And the components the entity owns will be removed at the same time.
Entity ID.
Returns the number of entities that have the given components. If you want to get the number of entities that match more complex combinations of components, see MatchCountByFilter().
Component class.
Returns the iterator of components by the first type you give. In this case, you can use EntityAdmin.SureSibling() to get other type components. Example:
for (const a of admin.GetComponentsByTuple(ComponentA, ComponentB, ComponentC)) {
// In this case, ComponentB and ComponentC must exist in a's owner entity. The a,b,c have the same owner entity.
const b: ComponentB = a.SureSibling(admin, ComponentB);
const c: ComponentC = a.SureSibling(admin, ComponentC);
// Can't confirm whether ComponentD exists.
const d: ComponentD | undefined = a.GetSibling(ComponentD);
}
A list of component class.
The iterator of T component instances.
Determine whether the entity owns the specified type component or not.
Entity ID.
Component class.
True means the type of component exist.
Returns the number of entities the filter matched.
Attention: The filter you given should be specified by EntityAdmin.AddWatchings() before.
Component combinations.
Push a deferment item. The deferment items will be processed in queue order at the end of each frame and then be cleared out. One EntityAdmin.UpdateSystems() call is one frame.
your function to deal delayed things
parameter list for your function
Remove component objects from an entity. If the entity or components do not exist, this method just do nothing, won't throw error.
Entity ID.
A list of component class.
Set a public component. Public component is Singleton pattern. It used for sharing data between Systems, but not for assigning to entity.
A Component instance
Actually the same as EntityAdmin.GetPubComponent(), but returns by a type assertion(not union undefined). If you are sure this type of component exist, call this method maybe better than EntityAdmin.GetPubComponent().
A Component class
Call all systems Update() method in order of their priority, and then deal deferment items you pushed before, at last clear deferment buffer. If the running state is false, it will do nothing.
Identify an entity exist or not.
Entity ID.
Return true means the entity exist.
The default running state is false. This method set it true. EntityAdmin.UpdateSystems() can work only in running===true state.
Set running state false. In this state, EntityAdmin.UpdateSystems() do nothing.
The manager of a World. It cantains systems, entities and the components. Components can be divided into two types: one is assigned to entities to describe the entities's attributes, and the other is common singleton components, which are used to share data between different systems.
EntityAdmin