Class: AbstractBlendState

(abstract) AbstractBlendState()

Base class for a state that blends a collection of AbstractState.

Constructor

(abstract) new AbstractBlendState()

Implements:

Members

(readonly) internalWeight :number

Gets the sum of internal weights of the sub-states.

Type:
  • number

Methods

cancel() → {boolean}

Cancel playback of the sub-states and cancel any pending promises.

Returns:
Type
boolean

discard() → {boolean}

Discards all sub-state resources.

Returns:
Type
boolean

getBlendWeight(name) → {number}

Returns the weight of a state controlled by the container.

Parameters:
Name Type Description
name string

Name of the state to return the weight from.

Returns:
  • Weight of the state.
Type
number

pause() → {boolean}

Pause playback of the sub-states. This prevents pending promises from being executed.

Returns:
Type
boolean

play(onFinishopt, onErroropt, onCancelopt) → {Deferred}

Start playback of the sub-states from the beginning.

Parameters:
Name Type Attributes Description
onFinish function <optional>

Function to execute when the state finishes.

onError function <optional>

Function to execute if the state encounters
an error during playback.

onCancel function <optional>

Function to execute if playback is canceled.

Returns:
Type
Deferred

resume(onFinishopt, onErroropt, onCancelopt) → {Deferred}

Resume playback of the sub-states.

Parameters:
Name Type Attributes Description
onFinish function <optional>

Function to execute when the state finishes.

onError function <optional>

Function to execute if the state encounters
an error during playback.

onCancel function <optional>

Function to execute if playback is canceled.

Returns:
Type
Deferred

setBlendWeight(name, weight) → {Deferred}

Sets the weight of a state controlled by the container.

Parameters:
Name Type Description
name string

Name of the state to set the weight of.

weight number

Weight value to set on the state.

Returns:
Type
Deferred

stop() → {boolean}

Stop playback of the sub-states and resolve any pending promises.

Returns:
Type
boolean

update(deltaTime)

Update any values of the sub-states that need to be evaluated every frame.

Parameters:
Name Type Description
deltaTime number

Time in milliseconds since the last update.

updateInternalWeight(factor)

Multiplies the weight of each sub-state by a factor to determine the internal weight.

Parameters:
Name Type Description
factor number

0-1 multiplier to apply to the user weight.