Skip to content

Latest commit

 

History

History
68 lines (59 loc) · 16.3 KB

World.md

File metadata and controls

68 lines (59 loc) · 16.3 KB

World Class

Represents a item used to create and manage Entity objects.

public sealed class World :
System.Collections.Generic.IEnumerable<DefaultEcs.Entity>,
System.Collections.IEnumerable,
DefaultEcs.IPublisher,
System.IDisposable

Inheritance System.Object 🡒 World

Implements System.Collections.Generic.IEnumerable<Entity>, System.Collections.IEnumerable, IPublisher, System.IDisposable

Constructors
World() Initializes a new instance of the World class.
World(int) Initializes a new instance of the World class.
Properties
MaxCapacity Gets the maximum number of Entity this World can handle.
Methods
CreateEntity() Creates a new instance of the Entity struct.
This method is not thread safe.
Dispose() Cleans up all the components of existing Entity.
The current World, all Entity and EntitySet created from this instance, should not be used again after calling this method.
Get<T>() Gets the component of type T on the current World.
GetAll<T>() Gets all the component of a given type T.
GetComponents<T>() Gets an Components<T> to get a fast access to the component of type T of this World instance Entity.
GetDisabledEntities() Gets an EntityQueryBuilder to create a subset of disabled Entity of the current World.
GetEntities() Gets an EntityQueryBuilder to create a subset of Entity of the current World.
GetEnumerator() Returns an enumerator that iterates through the Entity of the current World instance.
GetMaxCapacity<T>() Gets the maximum number of T components this World can create.
Has<T>() Returns whether the current World has a component of type T.
It has nothing to do whether or not the current World instance has an Entity with a component of type T.
Optimize() Sorts current instance inner storage so accessing Entity and their components from EntitySet and EntityMultiMap<TKey> always move forward in memory.
This method is not thread safe.
Optimize(IParallelRunner) Sorts current instance inner storage so accessing Entity and their components from EntitySet and EntityMultiMap<TKey> always move forward in memory.
This method is not thread safe.
Optimize(IParallelRunner, Action) Sorts current instance inner storage so accessing Entity and their components from EntitySet and EntityMultiMap<TKey> always move forward in memory.
This method will return once mainAction is executed even if the optimization process has not finished.
This method is not thread safe.
Publish<T>(T) Publishes a T object.
ReadAllComponentTypes(IComponentTypeReader) Calls on reader with all the maximum number of component of the current World.
This method is primiraly used for serialization purpose and should not be called in game logic.
Remove<T>() Removes the component of type T on the current World.
This method is not thread safe.
Set<T>() Sets the value of the component of type T to its default value on the current World.
This method is not thread safe.
Set<T>(T) Sets the value of the component of type T on the current World.
This method is not thread safe.
SetMaxCapacity<T>(int) Sets up the current World to handle component of type T with a different maximum count than MaxCapacity.
If the type of component is already handled by the current World, does nothing.
This method is not thread safe.
Subscribe<T>(MessageHandler<T>) Subscribes an MessageHandler<T>(T) to be called back when a T object is published.
SubscribeComponentAdded<T>(ComponentAddedHandler<T>) Subscribes a ComponentAddedHandler<T>(Entity, T) on the current World to be called when a component of type T is added.
SubscribeComponentChanged<T>(ComponentChangedHandler<T>) Subscribes a ComponentChangedHandler<T>(Entity, T, T) on the current World to be called when a component of type T is changed.
SubscribeComponentDisabled<T>(ComponentDisabledHandler<T>) Subscribes a ComponentDisabledHandler<T>(Entity, T) on the current World to be called when a component of type T is disabled.
SubscribeComponentEnabled<T>(ComponentEnabledHandler<T>) Subscribes a ComponentEnabledHandler<T>(Entity, T) on the current World to be called when a component of type T is enabled.
SubscribeComponentRemoved<T>(ComponentRemovedHandler<T>) Subscribes an ComponentRemovedHandler<T>(Entity, T) on the current World to be called when a component of type T is removed.
SubscribeEntityCreated(EntityCreatedHandler) Subscribes an EntityCreatedHandler(Entity) on the current World to be called when an Entity is created.
SubscribeEntityDisabled(EntityDisabledHandler) Subscribes an EntityDisabledHandler(Entity) on the current World to be called when an Entity is disabled.
SubscribeEntityDisposed(EntityDisposedHandler) Subscribes an EntityDisposedHandler(Entity) on the current World to be called when an Entity is disposed.
SubscribeEntityEnabled(EntityEnabledHandler) Subscribes an EntityEnabledHandler(Entity) on the current World to be called when an Entity is enabled.
SubscribeWorldDisposed(WorldDisposedHandler) Subscribes an WorldDisposedHandler(World) on the current World to be called when current instance is disposed.
ToString() Returns a string representation of this instance.
TrimExcess() Resizes all inner storage to exactly the number of Entity and components this World contains.
This method is not thread safe.
TrimExcess<T>() Resizes inner storage to exactly the number of T components this World contains.
This method is not thread safe.
Explicit Interface Implementations
System.Collections.Generic.IEnumerable<DefaultEcs.Entity>.GetEnumerator() Returns an enumerator that iterates through the Entity of the current World instance.
System.Collections.IEnumerable.GetEnumerator() Returns an enumerator that iterates through the Entity of the current World instance.