Constructor
(abstract) new StateHandler(stateName, context)
Create a state handler
Parameters:
| Name | Type | Description |
|---|---|---|
stateName |
string | The name of the state |
context |
OwenAnimationContext | The animation context |
- Source:
Members
context :OwenAnimationContext
The animation context
Type:
- OwenAnimationContext
- Source:
currentClip :AnimationClip|null
Currently playing animation clip
Type:
- AnimationClip | null
- Source:
nestedState :Object|null
Nested state information
Type:
- Object | null
- Source:
stateName :string
The name of this state
Type:
- string
- Source:
Methods
(async, abstract) enter(_fromStateopt, _emotionopt) → {Promise.<void>}
Enter this state
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
_fromState |
string | null | <optional> |
null |
The previous state (unused in base class) |
_emotion |
string | <optional> |
Emotions.NEUTRAL |
The emotion to enter with (unused in base class) |
- Source:
Throws:
-
Must be implemented by subclasses
- Type
- Error
Returns:
- Type
- Promise.<void>
(async, abstract) exit(_toStateopt, _emotionopt) → {Promise.<void>}
Exit this state
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
_toState |
string | null | <optional> |
null |
The next state (unused in base class) |
_emotion |
string | <optional> |
Emotions.NEUTRAL |
The emotion to exit with (unused in base class) |
- Source:
Throws:
-
Must be implemented by subclasses
- Type
- Error
Returns:
- Type
- Promise.<void>
getAvailableTransitions() → {Array.<string>}
Get available transitions from this state
- Source:
Returns:
Array of state names that can be transitioned to
- Type
- Array.<string>
(async) handleMessage(_message) → {Promise.<void>}
Handle a user message while in this state
Parameters:
| Name | Type | Description |
|---|---|---|
_message |
string |
The user message (unused in base class) |
- Source:
Returns:
- Type
- Promise.<void>
(async, protected) stopCurrentClip(fadeOutDurationopt) → {Promise.<void>}
Stop the currently playing clip
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
fadeOutDuration |
number | <optional> |
Fade out duration |
- Source:
Returns:
- Type
- Promise.<void>
update(_deltaTime) → {void}
Update this state (called every frame)
Parameters:
| Name | Type | Description |
|---|---|---|
_deltaTime |
number |
Time elapsed since last update (ms, unused in base class) |
- Source:
Returns:
- Type
- void
(async, protected) waitForClipEnd(clip) → {Promise.<void>}
Wait for an animation clip to finish playing
Parameters:
| Name | Type | Description |
|---|---|---|
clip |
AnimationClip |
The animation clip to wait for |
- Source:
Returns:
Promise that resolves when the clip finishes
- Type
- Promise.<void>