Class: SleepStateHandler

states.SleepStateHandler(context)

Handler for the Sleep state

Constructor

new SleepStateHandler(context)

Create a sleep state handler

Parameters:
Name Type Description
context OwenAnimationContext

The animation context

Source:

Extends

  • StateHandler

Members

isDeepSleep :boolean

Whether the character is in deep sleep

Type:
  • boolean
Source:

sleepClip :AnimationClip|null

Sleep animation clip

Type:
  • AnimationClip | null
Source:

Methods

(async) enter(fromStateopt, _emotionopt) → {Promise.<void>}

Enter the sleep state

Parameters:
Name Type Attributes Default Description
fromState string | null <optional>
null

The previous state

_emotion string <optional>
Emotions.NEUTRAL

The emotion to enter with (unused)

Source:
Returns:
Type
Promise.<void>

(async) exit(toStateopt, emotionopt) → {Promise.<void>}

Exit the sleep state

Parameters:
Name Type Attributes Default Description
toState string | null <optional>
null

The next state

emotion string <optional>
Emotions.NEUTRAL

The emotion to exit with

Source:
Returns:
Type
Promise.<void>

getAvailableTransitions() → {Array.<string>}

Get available transitions from sleep state

Source:
Returns:

Array of available state transitions

Type
Array.<string>

(async) handleMessage(_message) → {Promise.<void>}

Handle a user message in sleep state (wake up)

Parameters:
Name Type Description
_message string

The user message (unused, just triggers wake up)

Source:
Returns:
Type
Promise.<void>

isInDeepSleep() → {boolean}

Check if in deep sleep

Source:
Returns:

True if in deep sleep, false otherwise

Type
boolean

update(_deltaTime) → {void}

Update the sleep state

Parameters:
Name Type Description
_deltaTime number

Time elapsed since last update (ms, unused)

Source:
Returns:
Type
void

(async) wakeUp() → {Promise.<void>}

Force wake up from sleep

Source:
Returns:
Type
Promise.<void>