refactor(hero): 重命名属性事件队列并添加添加方法
将 HeroAttrEvent 类中的 AttrEvent 属性重命名为 AttrEvents 以更符合命名规范 添加 addAttrEvent 方法以封装事件添加逻辑 移除不必要的注释以保持代码简洁
This commit is contained in:
@@ -1,29 +1,20 @@
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { Attrs } from "../common/config/HeroAttrs";
|
||||
|
||||
/**
|
||||
* ==================== 伤害事件数据 ====================
|
||||
*
|
||||
* 单个伤害事件的数据结构
|
||||
*/
|
||||
export interface AttrEvent {
|
||||
/** 伤害属性数据 */
|
||||
Attr: Attrs;
|
||||
Value:number;
|
||||
}
|
||||
|
||||
/**
|
||||
* ==================== 伤害队列组件 ====================
|
||||
*
|
||||
* 用途:
|
||||
|
||||
*/
|
||||
@ecs.register('HeroAttrEvent')
|
||||
export class HeroAttrEvent extends ecs.Comp {
|
||||
/** 伤害事件队列 */
|
||||
AttrEvent: AttrEvent[] = [];
|
||||
reset() {
|
||||
this.AttrEvent = [];
|
||||
|
||||
|
||||
AttrEvents:AttrEvent[] = [];
|
||||
addAttrEvent(event:AttrEvent){
|
||||
this.AttrEvents.push(event);
|
||||
}
|
||||
reset() {
|
||||
this.AttrEvents = [];
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user