战斗系统 重构继续
This commit is contained in:
@@ -4,7 +4,7 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ec
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { BoxSet, FacSet } from "../common/config/BoxSet";
|
||||
import { HeroInfo } from "../common/config/heroSet";
|
||||
import { MonModelComp } from "./MonModelComp";
|
||||
import { MonAttrsComp } from "./MonAttrsComp";
|
||||
import { BattleMoveComp } from "../common/ecs/position/BattleMoveComp";
|
||||
import { SkillConComp } from "./SkillConComp";
|
||||
import { BuffConf, SkillSet } from "../common/config/SkillSet";
|
||||
@@ -12,26 +12,26 @@ import { getNeAttrs, getAttrs ,Attrs} from "../common/config/HeroAttrs";
|
||||
import { TalComp } from "./TalComp";
|
||||
import { getMonAttr, MonType } from "../map/RogueConfig";
|
||||
import { EBusComp } from "./EBusComp";
|
||||
import { MonViewComp } from "./MonViewComp";
|
||||
import { HeroViewComp } from "./HeroViewComp";
|
||||
/** 角色实体 */
|
||||
@ecs.register(`Monster`)
|
||||
export class Monster extends ecs.Entity {
|
||||
HeroModel!: MonModelComp;
|
||||
HeroView!: MonViewComp;
|
||||
HeroModel!: MonAttrsComp;
|
||||
HeroView!: HeroViewComp;
|
||||
BattleMove!: BattleMoveComp;
|
||||
|
||||
protected init() {
|
||||
this.addComponents<ecs.Comp>(
|
||||
BattleMoveComp,
|
||||
MonModelComp,
|
||||
MonAttrsComp,
|
||||
TalComp,
|
||||
EBusComp,
|
||||
);
|
||||
}
|
||||
|
||||
destroy(): void {
|
||||
this.remove(MonViewComp);
|
||||
this.remove(MonModelComp);
|
||||
this.remove(HeroViewComp);
|
||||
this.remove(MonAttrsComp);
|
||||
this.remove(TalComp);
|
||||
this.remove(EBusComp);
|
||||
super.destroy();
|
||||
@@ -52,8 +52,8 @@ export class Monster extends ecs.Entity {
|
||||
node.setPosition(pos)
|
||||
|
||||
|
||||
var view = node.getComponent(MonViewComp)!;
|
||||
const model = this.get(MonModelComp);
|
||||
var view = node.getComponent(HeroViewComp)!;
|
||||
const model = this.get(MonAttrsComp);
|
||||
let hero = HeroInfo[uuid]; // 共用英雄数据
|
||||
// 设置 View 层属性(表现相关)
|
||||
view.scale = scale;
|
||||
@@ -116,16 +116,16 @@ export class MonLifecycleSystem extends ecs.ComblockSystem
|
||||
implements ecs.IEntityEnterSystem, ecs.IEntityRemoveSystem {
|
||||
|
||||
filter() {
|
||||
return ecs.allOf(MonModelComp);
|
||||
return ecs.allOf(MonAttrsComp);
|
||||
}
|
||||
|
||||
entityEnter(e: ecs.Entity): void {
|
||||
// 英雄实体创建时的特殊处理
|
||||
console.log(`怪物进入世界: ${e.get(MonModelComp).hero_name}`);
|
||||
console.log(`怪物进入世界: ${e.get(MonAttrsComp).hero_name}`);
|
||||
}
|
||||
|
||||
entityRemove(e: ecs.Entity): void {
|
||||
// 英雄实体销毁时的清理工作
|
||||
console.log(`怪物离开世界: ${e.get(MonModelComp).hero_name}`);
|
||||
console.log(`怪物离开世界: ${e.get(MonAttrsComp).hero_name}`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user