Actor

Actor

new Actor(data, savedDataopt, presetIdopt)

场景角色对象

Source:
Parameters:
Name Type Attributes Description
data ActorFile

角色文件数据

savedData Object <optional>

角色存档数据

presetId string <optional>

角色预设数据ID

Members

active :boolean

角色的激活状态

Source:
Type:
  • boolean

angle :number

角色的角度

Source:
Type:
  • number

angleFixed :boolean

是否固定角度

Source:
Type:
  • boolean

animation :Animation

角色动画播放器组件

Source:
Type:

animationController :AnimationController

角色动画控制器组件

Source:
Type:

animationManager :Array.<Animation>

角色动画管理器

Source:
Type:

attributes :Object

角色属性映射表

Source:
Type:

cellId :number

角色的场景分区ID

Source:
Type:
  • number

clip :Array.<number>

角色头像矩形裁剪区域

Source:
Type:

collider :ActorCollider

角色碰撞器组件

Source:
Type:

cooldownManager :CooldownManager

角色公共冷却管理器

Source:
Type:

data :Object

角色文件数据

Source:
Type:

defineTempAttributes :function

定义临时属性映射表方法

Source:
Type:
  • function

destroyed :boolean

角色是否已销毁

Source:
Type:
  • boolean

entityId :string

角色对象实体ID

Source:
Type:
  • string

equipmentManager :EquipmentManager

角色装备管理器

Source:
Type:

events :Object

角色事件类型映射表

Source:
Type:

gridId :number

角色的场景网格ID

Source:
Type:
  • number

hitTimestamp :number

受击时间戳

Source:
Type:
  • number

intX :number

角色的整数位置X

Source:
Type:
  • number

intY :number

角色的整数位置Y

Source:
Type:
  • number

inventory :Inventory

角色库存管理器

Source:
Type:

latest :Actor|undefined

最新创建的角色

Source:
Type:

name :string

角色对象名称

Source:
Type:
  • string

角色导航器组件

Source:
Type:

parent :SceneActorList|null

角色的父级对象

Source:
Type:

passage :number

角色的通行区域

Source:
Type:
  • number

passageMap

通行区域映射表

Source:

portrait :string

角色头像ID

Source:
Type:
  • string

presetId :string

角色预设数据ID

Source:
Type:
  • string

priority :number

角色的渲染优先级

Source:
Type:
  • number

scale :number

角色的缩放系数

Source:
Type:
  • number

script :Script

角色脚本管理器

Source:
Type:

selfVarId :string

角色独立变量ID

Source:
Type:
  • string

shortcutManager :ShortcutManager

角色快捷栏管理器

Source:
Type:

skillManager :SkillManager

角色技能管理器

Source:
Type:

sprites :Object

角色动画精灵图表

Source:
Type:

started :boolean

已开始状态

Source:
Type:
  • boolean

stateManager :StateManager

角色状态管理器

Source:
Type:

targetManager :TargetManager

角色目标对象管理器

Source:
Type:

teamId :string

角色队伍ID

Source:
Type:
  • string

teamIndex :number

角色队伍索引

Source:
Type:
  • number

updaters :ModuleList

角色更新器列表

Source:
Type:

visible :boolean

角色对象可见性

Source:
Type:
  • boolean

x :number

角色的场景位置X

Source:
Type:
  • number

y :number

角色的场景位置Y

Source:
Type:
  • number

Methods

callEvent(type) → {EventHandler|undefined}

调用角色事件

Source:
Parameters:
Name Type Description
type string

角色事件类型

Returns:
Type:
EventHandler | undefined

destroy()

销毁角色

Source:

emit(type)

调用角色事件和脚本

Source:
Parameters:
Name Type Description
type string

角色事件类型

isActive() → {boolean}

判断角色是否处于激活状态(并且已出场)

Source:
Returns:
Type:
boolean

loadAttributes()

加载初始角色属性

Source:

loadEquipments()

加载初始角色装备

Source:

loadInventory()

加载初始角色库存

Source:

loadSkills()

加载初始角色技能

Source:

loadSprites()

加载初始动画精灵哈希表

Source:

move(x, y)

移动角色

Source:
Parameters:
Name Type Description
x number

位移X

y number

位移Y

restoreInventory()

恢复角色的库存引用

Source:

rotate(angle, easingIdopt, durationopt, keyopt)

角色旋转指定的角度

Source:
Parameters:
Name Type Attributes Default Description
angle number

旋转角度(弧度)

easingId string <optional>

过渡曲线ID

duration number <optional>

持续时间(毫秒)

key string <optional>
rotate

旋转更新器的键(指定以避免冲突)

saveData()

保存角色数据

Source:

setActive(active)

设置角色的激活状态

Source:
Parameters:
Name Type Description
active boolean

如果禁用,角色将不再更新事件和脚本

setAngle(angle, easingIdopt, durationopt)

设置角色的角度

Source:
Parameters:
Name Type Attributes Description
angle number

角色角度(弧度)

easingId string <optional>

过度曲线ID

duration number <optional>

持续时间(毫秒)

setAnimation(animationId)

设置角色动画

Source:
Parameters:
Name Type Description
animationId string

动画文件ID

setPassage(passage)

设置通行区域

Source:
Parameters:
Name Type Description
passage string

通行区域

setPosition(x, y)

设置角色在场景中的位置

Source:
Parameters:
Name Type Description
x number

场景网格X

y number

场景网格Y

setScale(scale, easingId, durationopt)

设置角色的缩放系数

Source:
Parameters:
Name Type Attributes Description
scale number

角色缩放系数

easingId string

过渡曲线ID

duration number <optional>

持续时间(毫秒)

setSprite(spriteId, imageId)

设置角色的精灵图

Source:
Parameters:
Name Type Description
spriteId string

精灵图ID

imageId string

图像文件ID

setTeam(teamId)

设置角色的队伍

Source:
Parameters:
Name Type Description
teamId string

队伍ID

translate(angle, distance, easingIdopt, durationopt, keyopt)

角色朝指定角度位移一段距离

Source:
Parameters:
Name Type Attributes Default Description
angle number

位移角度(弧度)

distance number

位移距离(单位:图块)

easingId string <optional>

过渡曲线ID

duration number <optional>

持续时间(毫秒)

key string <optional>
translate

位移更新器的键(指定以避免冲突)

update(deltaTime)

更新角色的模块

Source:
Parameters:
Name Type Description
deltaTime number

增量时间(毫秒)

updateAngle(angle)

更新角色的角度,并计算动画动作方向

Source:
Parameters:
Name Type Description
angle number

弧度

updateGridPosition()

更新角色在场景中的网格位置

Source:

updateHitTimestamp()

更新受击时间戳

Source:

useInventory(inventory)

使用指定全局角色的库存

Source:
Parameters:
Name Type Description
inventory Inventory

全局角色的库存

(static) initialize()

初始化角色相关的数据

Source: