Skip to main content

add 添加角色状态

add

类型: MethodDeclaration

所属类: StateManager

定义位置: actor.ts

描述

添加角色状态

参数 state: 状态实例

参数

参数名类型描述默认值
stateState--

返回值

类型: void

源代码

位置: 第 3781 行

public add(state: State): void {
const { id } = state;
const { idMap } = this;
// 如果存在该状态,先移除
if (id in idMap) {
this.remove(idMap[id]!);
}
idMap[id] = state;
this.version++;
this.countdownList.append(state);
state.parent = this;
state.emit("stateadd");
}

文档生成时间:2026/2/1 16:51:38