添加buff comp

This commit is contained in:
walkpan
2024-08-27 13:23:05 +08:00
parent 45a230db33
commit 007b85fe7f
6 changed files with 177 additions and 56 deletions

View File

@@ -17,13 +17,15 @@ import { MonsterViewComp } from "./MonsterViewComp";
import { CardSet } from "../common/config/CardSet";
import { BoxSet } from "../common/config/BoxSet";
import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
import { MonsterBuffComp } from "./MonsterBuffComp";
/** 角色实体 */
@ecs.register(`Monster`)
export class Monster extends ecs.Entity {
// 数据层
MonsterModel!: MonsterModelComp;
// 视图层
MonsterView!: MonsterViewComp; // 移动
MonsterView!: MonsterViewComp;
MonsterBuff!: MonsterBuffComp; // 移动
protected init() {
this.addComponents<ecs.Comp>(
@@ -34,6 +36,7 @@ export class Monster extends ecs.Entity {
destroy(): void {
this.remove(MonsterViewComp);
this.remove(MonsterBuffComp);
super.destroy();
}
@@ -81,6 +84,7 @@ export class Monster 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.speed =mv.ospeed = smc.heros[uuid].speed;
mv.hero_name= smc.heros[uuid].name;
mv.box_group= BoxSet.MONSTER;
@@ -95,6 +99,7 @@ export class Monster extends ecs.Entity {
mv.scale = -1;
mv.Tpos = v3(0,0,0);
this.add(mv);
this.add(buff)
}
}