修复 buff 逻辑处理 bug : 预制体不能设置全局监听oops.message.on,会一直执行

This commit is contained in:
walkpan
2024-08-28 00:09:55 +08:00
parent 5b1991c90f
commit 4096a17330
15 changed files with 195 additions and 143 deletions

View File

@@ -17,6 +17,7 @@ import { MonsterViewComp } from "./MonsterViewComp";
import {HeroModelComp} from "./HeroModelComp";
import { CardSet } from "../common/config/CardSet";
import { BoxSet } from "../common/config/BoxSet";
import { MonsterBuffComp } from "./MonsterBuffComp";
/** 角色实体 */
@ecs.register(`Hero`)
export class Hero extends ecs.Entity {
@@ -31,7 +32,8 @@ export class Hero extends ecs.Entity {
destroy(): void {
this.remove(MonsterViewComp);
this.remove(MonsterModelComp);
this.remove(HeroModelComp);
this.remove(MonsterBuffComp);
super.destroy();
}
@@ -83,10 +85,11 @@ export class Hero extends ecs.Entity {
}
hero_init(uuid:number=1001,node:Node,pos:Vec3=v3(0,0,0)){
var mv = node.getComponent(MonsterViewComp)!;
var buff =node.getComponent(MonsterBuffComp)!;
mv.hero_uuid=uuid;
mv.speed =mv.ospeed = smc.heros[uuid].speed;
mv.hero_name= smc.heros[uuid].name;
mv.box_group= BoxSet.HERO;
buff.group= mv.box_group= BoxSet.HERO;
mv.hp= mv.hp_max = smc.heros[uuid].hp;
mv.level = smc.heros[uuid].level;
mv.atk = smc.heros[uuid].atk;
@@ -99,6 +102,7 @@ export class Hero extends ecs.Entity {
mv.scale = 1;
// mv.change_name(smc.heros[uuid].name,1)
this.add(mv);
this.add(buff);
}