API Docs for:
Show:

Component_CharacterBehavior Class

Module: vn

A behavior-component which handles the character-specific behavior like talking and idle.

Methods

changeExpression

(
  • expression
  • duration
  • [callback]
)

Changes the characters expression using blending. If the duration is set to 0 the expression change is executed immediately without animation.

Parameters:

  • expression vn.CharacterExpression
    • The character expression database-record.
  • duration Number
    • The animation-duration in frames. Pass 0 to skip animation.
  • [callback] Function optional

    An optional callback-function called when the change is finished.

onDataBundleRestore.

(
  • Object
  • gs.ObjectCodecContext
)

Provided by the gs module.

Called if this object instance is restored from a data-bundle. It can be used re-assign event-handler, anonymous functions, etc.

Parameters:

  • Object Object

    data - The data-bundle

  • gs.ObjectCodecContext Object

    context - The codec-context.

setup

()

Initializes the component. Adds event-handlers.

setupEventHandlers

()

Adds event-handlers

startTalking

()

Lets the character start talking.

stopTalking

()

Lets the character stop with talking.

update

()

Updates character logic & animation-handling.

updateIdle

() protected

Updates character's idle-animation.

updateTalking

() protected

Updates character's talking-animation.

Properties

idleTime

Number private

imageDuration

Number private

imageIndex

Number private

imageIndex

Number

Temporary game settings used by this character.

initialized

Boolean private

talking

Boolean

Indicates if the character is currently talking.