Table of Contents

Interface IComponentList<TEntity>

Namespace
MonkeyLoader.Components
Assembly
MonkeyLoader.dll

Defines the interface for the component list of entities.

public interface IComponentList<out TEntity> where TEntity : class, IEntity<out TEntity>

Type Parameters

TEntity

The type of the entity.

Properties

Entity

Gets the entity that this component list is for.

TEntity Entity { get; }

Property Value

TEntity

Methods

Add(IComponent<TEntity>)

Adds a component to this Entity's component list.

void Add(IComponent<out TEntity> component)

Parameters

component IComponent<TEntity>

The component to add.

GetAll<TComponent>()

Gets a sequence of all components assignable to TComponent, in order of insertion.

IEnumerable<TComponent> GetAll<TComponent>() where TComponent : class, IComponent<out TEntity>

Returns

IEnumerable<TComponent>

A sequence of all matching components in order of insertion.

Type Parameters

TComponent

The type of the component(s). Should be an interface.

GetAll<TComponent>(Predicate<TComponent>)

Gets a sequence of all components assignable to TComponent, in order of insertion.

IEnumerable<TComponent> GetAll<TComponent>(Predicate<TComponent> predicate) where TComponent : class, IComponent<out TEntity>

Parameters

predicate Predicate<TComponent>

A function to test each component for a condition.

Returns

IEnumerable<TComponent>

A sequence of all matching components in order of insertion that satisfy the predicate.

Type Parameters

TComponent

The type of the component(s). Should be an interface.

Get<TComponent>()

Gets the first component (in order of insertion) assignable to TComponent.

TComponent Get<TComponent>() where TComponent : class, IComponent<out TEntity>

Returns

TComponent

The found TComponent.

Type Parameters

TComponent

The type of the component. Should be an interface.

Exceptions

ComponentNotFoundException

When there is no TComponent.

Get<TComponent>(Predicate<TComponent>)

Gets the first component (in order of insertion) assignable to TComponent.

TComponent Get<TComponent>(Predicate<TComponent> predicate) where TComponent : class, IComponent<out TEntity>

Parameters

predicate Predicate<TComponent>

A function to test each component for a condition.

Returns

TComponent

The found TComponent.

Type Parameters

TComponent

The type of the component. Should be an interface.

Exceptions

ComponentNotFoundException

When there is no TComponent that satisfies the predicate.

TryGet<TComponent>(Predicate<TComponent>, out TComponent?)

Tries to get the first component (in order of insertion) assignable to TComponent that satisfied the predicate.

bool TryGet<TComponent>(Predicate<TComponent> predicate, out TComponent? component) where TComponent : class, IComponent<out TEntity>

Parameters

predicate Predicate<TComponent>

A function to test each component for a condition.

component TComponent

The component if one was found; otherwise, default(TComponent).

Returns

bool

true if a TComponent satisfying the predicate was found; otherwise, false.

Type Parameters

TComponent

The type of the component. Should be an interface.

TryGet<TComponent>(out TComponent?)

Tries to get the first component (in order of insertion) assignable to TComponent.

bool TryGet<TComponent>(out TComponent? component) where TComponent : class, IComponent<out TEntity>

Parameters

component TComponent

The component if one was found; otherwise, default(TComponent).

Returns

bool

true if a TComponent was found; otherwise, false.

Type Parameters

TComponent

The type of the component. Should be an interface.