Class BehaviourRegistry<T>

Namespace
SurvivorsMaker.Simulation
Assembly
SurvivorsMaker.Simulation.dll

Behaviours by id. Ids are case-sensitive. Registering an id that exists replaces it, so a game can override a built-in. Ids keeps first-registration order for tools.

public sealed class BehaviourRegistry<T> where T : class

Type Parameters

T
Inheritance
BehaviourRegistry<T>
Inherited Members

Constructors

BehaviourRegistry()

public BehaviourRegistry()

Properties

Ids

public IReadOnlyList<string> Ids { get; }

Property Value

IReadOnlyList<string>

Methods

Contains(string)

public bool Contains(string id)

Parameters

id string

Returns

bool

Get(string)

Throws InvalidOperationException naming the id when it is not registered.

public T Get(string id)

Parameters

id string

Returns

T

Register(string, T)

public void Register(string id, T behaviour)

Parameters

id string
behaviour T

TryGet(string, out T)

public bool TryGet(string id, out T behaviour)

Parameters

id string
behaviour T

Returns

bool