Table of Contents

Class State

Namespace
Exiled.API.Features.Core.StateMachine
Assembly
Exiled.API.dll

The base class which handles in-context states.

public abstract class State : EActor, IEntity, IWorldSpace, IPosition, IRotation, IState
Inheritance
State
Implements
Inherited Members
Extension Methods

Properties

ActiveControllers

Gets all the StateControllers running on this State.

public IEnumerable<StateController> ActiveControllers { get; }

Property Value

IEnumerable<StateController>

Controllers

Gets all the StateControllers listening to this State.

public IEnumerable<StateController> Controllers { get; }

Property Value

IEnumerable<StateController>

Description

Gets the state's description.

public virtual string Description { get; }

Property Value

string

Id

Gets the state's id.

public abstract byte Id { get; }

Property Value

byte

InactiveControllers

Gets all the StateControllers running on a State other than this.

public IEnumerable<StateController> InactiveControllers { get; }

Property Value

IEnumerable<StateController>

List

Gets all registered states.

public static IEnumerable<State> List { get; }

Property Value

IEnumerable<State>

Name

Gets the state's name.

public virtual string Name { get; }

Property Value

string

Methods

Get(byte)

Gets the State belonging to the specified id.

public static State Get(byte id)

Parameters

id byte

The state's id.

Returns

State

The corresponding State, or null if not found.

Get(byte, byte)

Gets the States belonging to the specified id between the defined range.

public static IEnumerable<State> Get(byte minRange, byte maxRange)

Parameters

minRange byte

The minimum inclusive range.

maxRange byte

The maximum exclusive range.

Returns

IEnumerable<State>

All States belonging to the specified id between the specified range.

Get(params byte[])

Gets the States belonging to the specified id between the defined ids.

public static IEnumerable<State> Get(params byte[] ids)

Parameters

ids byte[]

The ids to look for.

Returns

IEnumerable<State>

All States belonging to the specified id between the defined ids.

Get(string)

Gets the State belonging to the specified name.

public static State Get(string name)

Parameters

name string

The state's name.

Returns

State

The corresponding State, or null if not found.

Get(params string[])

Gets the States belonging to the specified id between the defined names.

public static IEnumerable<State> Get(params string[] names)

Parameters

names string[]

The names to look for.

Returns

IEnumerable<State>

All States belonging to the specified id between the defined names.

Get(Type)

Gets the State belonging to the specified Type.

public static State Get(Type type)

Parameters

type Type

The state's Type.

Returns

State

The corresponding State, or null if not found.

Get(params Type[])

Gets the States belonging to the specified id between the defined types.

public static IEnumerable<State> Get(params Type[] types)

Parameters

types Type[]

The types to look for.

Returns

IEnumerable<State>

All States belonging to the specified id between the defined types.

Get<T>()

Gets the State belonging to the specified type T.

public static T Get<T>() where T : State

Returns

T

The corresponding State, or null if not found.

Type Parameters

T

The type to look for.

InitializeStates(bool)

Initializes all states defined in the executing Assembly.

public static void InitializeStates(bool useAttribute = true)

Parameters

useAttribute bool

A value indicating whether attribute should be used.

OnEnter(StateController)

Fired when entering the state.

public virtual void OnEnter(StateController stateController)

Parameters

stateController StateController

The state controller.

OnExit(StateController)

Fired when exiting the state.

public virtual void OnExit(StateController stateController)

Parameters

stateController StateController

The state controller.

Tick()

Fired every tick.

protected override void Tick()

ToString()

Converts the State to a human readable string representation.

public override string ToString()

Returns

string

A human readable string representation of the State object.

TryGet(byte, out State)

Tries to get a State given the specified id.

public static bool TryGet(byte id, out State state)

Parameters

id byte

The state's id.

state State

The corresponding State, or null if not found.

Returns

bool

true if a State was found; otherwise, false.

TryGet(string, out State)

Tries to get a State given the specified name.

public static bool TryGet(string name, out State state)

Parameters

name string

The state's name.

state State

The corresponding State, or null if not found.

Returns

bool

true if a State was found; otherwise, false.

TryGet(Type, out State)

Tries to get a State given the specified Type.

public static bool TryGet(Type type, out State state)

Parameters

type Type

The state's Type.

state State

The corresponding State, or null if not found.

Returns

bool

true if a State was found; otherwise, false.

TryGet<T>(out T)

Tries to get a State given the specified Type.

public bool TryGet<T>(out T state) where T : State

Parameters

state T

The corresponding State, or null if not found.

Returns

bool

true if a State was found; otherwise, false.

Type Parameters

T

The type to look for.