Skip to main content

CharacterStateMachine

ZEPETO.Character.Controller.CharacterStateMachine

Class responsible for synchronizing the animator with the character state of a ZEPETO character.

Hierarchy

Constructors

constructor

new CharacterStateMachine()

Inherited from

StateMachine$1.constructor

Properties

OnChangedState

OnChangedState: Action$2<CharacterState, CharacterState>

Event triggered when the camera state changes. Registered listeners receive two parameters:

  • The new state.
  • The previous state.

Inherited from

StateMachine$1.OnChangedState

Accessors

Current

get Current(): State$1<TEnum>

Retrieves the current state.

Returns

State$1<TEnum>

Inherited from

StateMachine$1.Current


Events

get Events(): TransitionBase$1<TEnum>[]

Provides an array of all the events defined in the state machine.

Returns

TransitionBase$1<TEnum>[]

Inherited from

StateMachine$1.Events


IsRunning

get IsRunning(): boolean

Indicates whether the state machine is actively processing states and transitions.

Returns

boolean

Inherited from

StateMachine$1.IsRunning


Prev

get Prev(): State$1<TEnum>

Retrieves the previous state.

Returns

State$1<TEnum>

Inherited from

StateMachine$1.Prev


constraintStateAnimation

get constraintStateAnimation(): boolean

Determines whether to synchronize the animator with the current character state of the ZEPETO character. If set to true, the animator state will not be updated based on the current character state.

Returns

boolean

set constraintStateAnimation(value): void

Determines whether to synchronize the animator with the current character state of the ZEPETO character. If set to true, the animator state will not be updated based on the current character state.

Parameters

NameType
valueboolean

Returns

void


stateCount

get stateCount(): number

Retrieves the count of states defined in the state machine.

Returns

number

Inherited from

StateMachine$1.stateCount


transitionCount

get transitionCount(): number

Retrieves the count of transitions defined in the state machine.

Returns

number

Inherited from

StateMachine$1.transitionCount

Methods

ChangeStateAnimation

ChangeStateAnimation($state): void

Plays the animation associated with the provided character state on the animator.

Parameters

NameTypeDescription
$stateCharacterStateCharacter state representing the animation to play.

Returns

void


EnterState

EnterState($state): void

Transitions the state machine into a specified state.

Parameters

NameTypeDescription
$stateCharacterStateThe state to which the state machine will transition.

Returns

void

Inherited from

StateMachine$1.EnterState


FindState

FindState($state, $success, $failed): void

Finds a state within the state machine and executes a callback on success.

Parameters

NameTypeDescription
$stateCharacterStateState to find within the state machine.
$successAction$1<State$1<CharacterState>>Callback function to handle the found State.
$failedActionCallback function to handle the case when the state is not found.

Returns

void

Inherited from

StateMachine$1.FindState


FindTransition

FindTransition($from, $to, $success, $failed): void

Finds a transition within the state machine and executes a callback on success.

Parameters

NameTypeDescription
$fromCharacterStateState from which the transition starts.
$toCharacterStateState to which the transition will occur.
$successAction$1<Transition$1<CharacterState>>Callback function to handle the found Transition.
$failedActionCallback function to handle the case when the transition is not found.

Returns

void

Inherited from

StateMachine$1.FindTransition


FindTransitions

FindTransitions($from, $success, $failed): void

Finds transitions within the state machine and executes a callback on success.

Parameters

NameTypeDescription
$fromCharacterStateState from which the transition starts.
$successAction$1<Transition$1<CharacterState>[]>Callback function to handle the found array of Transition.
$failedActionCallback function to handle the case when transitions are not found.

Returns

void

Inherited from

StateMachine$1.FindTransitions


LeaveState

LeaveState($nextState): void

The state machine exits the current state.

Parameters

NameTypeDescription
$nextStateCharacterStateThe next state to be handled by the current state's OnLeave.

Returns

void

Inherited from

StateMachine$1.LeaveState


Start

Start($state): void

Initiates the processing of the state machine.

Parameters

NameTypeDescription
$stateCharacterStateState from which the state machine will start its processing.

Returns

void

Inherited from

StateMachine$1.Start


Stop

Stop(): void

Stops the processing of the state machine.

Returns

void

Inherited from

StateMachine$1.Stop


SyncStateAnimation

SyncStateAnimation(): void

Synchronizes the animator with the current character state of the ZEPETO character.

Returns

void


Update

Update($deltaTime): void

Updates the current state and transition of the state machine.

Parameters

NameTypeDescription
$deltaTimenumberTime elapsed in seconds since the last Update call.

Returns

void

Inherited from

StateMachine$1.Update