Table of Contents

Class CommandBuffer

Namespace
Frent.Core
Assembly
Frent.dll

Stores a set of structual changes that can be applied to a World.

public class CommandBuffer
Inheritance
CommandBuffer
Inherited Members

Constructors

CommandBuffer(World)

Creates a command buffer, which stores changes to a world without directly applying them.

public CommandBuffer(World world)

Parameters

world World

The world to apply things to.

Properties

HasBufferItems

Whether or not the buffer currently has items to be played back.

public bool HasBufferItems { get; }

Property Value

bool

Methods

AddComponent(Entity, ComponentID, object)

Adds a component to an entity when Playback() is called.

public void AddComponent(Entity entity, ComponentID componentID, object component)

Parameters

entity Entity

The entity to add to.

componentID ComponentID

The ID of the component type to add as.

component object

The component to add.

Remarks

component must be assignable to Type.

AddComponent(Entity, object)

Adds a component to an entity when Playback() is called.

public void AddComponent(Entity entity, object component)

Parameters

entity Entity

The entity to add to.

component object

The component to add.

AddComponent(Entity, Type, object)

Adds a component to an entity when Playback() is called.

public void AddComponent(Entity entity, Type componentType, object component)

Parameters

entity Entity

The entity to add to.

componentType Type

The type to add the component as.

component object

The component to add.

Remarks

component must be assignable to componentType.

AddComponent<T>(Entity, in T)

Adds a component to an entity when Playback() is called.

public void AddComponent<T>(Entity entity, in T component)

Parameters

entity Entity

The entity to add to.

component T

The component to add.

Type Parameters

T

The component type to add.

Clear()

Removes all commands without playing them back.

public void Clear()

Remarks

This command also removes all empty entities (without events) that have been created by this command buffer.

DeleteEntity(Entity)

Deletes a component from when Playback() is called.

public void DeleteEntity(Entity entity)

Parameters

entity Entity

The entity that will be deleted on playback.

Detach(Entity, TagID)

Detaches a tag from an entity when Playback() is called.

public void Detach(Entity entity, TagID tagID)

Parameters

entity Entity

The entity to detach from.

tagID TagID

The ID of the tag type to detach from the entity.

Detach<T>(Entity)

Detaches a tag from an entity when Playback() is called.

public void Detach<T>(Entity entity)

Parameters

entity Entity

The entity to detach from.

Type Parameters

T

The type of tag to detach.

End()

Finishes recording entity creation and returns an entity with zero components. Recorded components will be added on playback.

public Entity End()

Returns

Entity

The created entity ID

Entity()

Begins to create an entity, which will be resolved when Playback() is called.

public CommandBuffer Entity()

Returns

CommandBuffer

this instance, for method chaining.

Exceptions

InvalidOperationException

An entity is already being created.

Playback()

Plays all the queued commands, applying them to a world.

public bool Playback()

Returns

bool

true when at least one change was made; false when this command buffer is empty and not active.

RemoveComponent(Entity, ComponentID)

Removes a component from when Playback() is called.

public void RemoveComponent(Entity entity, ComponentID component)

Parameters

entity Entity

The entity to remove a component from.

component ComponentID

The component to remove.

RemoveComponent(Entity, Type)

Removes a component from when Playback() is called.

public void RemoveComponent(Entity entity, Type type)

Parameters

entity Entity

The entity to remove a component from.

type Type

The type of component to remove.

RemoveComponent<T>(Entity)

Removes a component from when Playback() is called.

public void RemoveComponent<T>(Entity entity)

Parameters

entity Entity

The entity to remove a component from.

Type Parameters

T

The component type to remove.

Tag(Entity, TagID)

Tags an entity with a tag when Playback() is called.

public void Tag(Entity entity, TagID tagID)

Parameters

entity Entity

The entity to tag.

tagID TagID

The ID of the tag type to tag.

Tag<T>(Entity)

Tags an entity with a tag when Playback() is called.

public void Tag<T>(Entity entity)

Parameters

entity Entity

The entity to tag.

Type Parameters

T

The type to tag the entity with.

WithBoxed(ComponentID, object)

Records component to be part of the entity created when resolved as a component type represented by componentID.

public CommandBuffer WithBoxed(ComponentID componentID, object component)

Parameters

componentID ComponentID
component object

Returns

CommandBuffer

this instance, for method chaining.

Exceptions

InvalidOperationException

Entity() has not been called."/>

WithBoxed(object)

Records component to be part of the entity created when resolved.

public CommandBuffer WithBoxed(object component)

Parameters

component object

Returns

CommandBuffer

this instance, for method chaining.

Exceptions

InvalidOperationException

Entity() has not been called."/>

WithBoxed(Type, object)

Records component to be part of the entity created when resolved as a component type of type.

public CommandBuffer WithBoxed(Type type, object component)

Parameters

type Type
component object

Returns

CommandBuffer

this instance, for method chaining.

Exceptions

InvalidOperationException

Entity() has not been called."/>

With<T>(T)

Records component to be part of the entity created when resolved.

public CommandBuffer With<T>(T component)

Parameters

component T

Returns

CommandBuffer

this instance, for method chaining.

Type Parameters

T

Exceptions

InvalidOperationException

Entity() has not been called."/>