去掉了 技能系统,技能由单个精灵独立处理
This commit is contained in:
@@ -7,8 +7,8 @@ import { HeroViewComp } from "./HeroViewComp";
|
||||
import { BoxSet } from "../common/config/BoxSet";
|
||||
import { HeroInfo } from "../common/config/heroSet";
|
||||
import { BattleMoveComp } from "../common/ecs/position/BattleMoveComp";
|
||||
import { HeroSkillsComp } from "../skill/heroSkillsComp";
|
||||
import { HartModelComp } from "./HartModelComp";
|
||||
import { SkillConComp } from "./SkillConComp";
|
||||
/** 角色实体 */
|
||||
@ecs.register(`Hero`)
|
||||
|
||||
@@ -20,12 +20,13 @@ export class Hero extends ecs.Entity {
|
||||
protected init() {
|
||||
this.addComponents<ecs.Comp>(
|
||||
BattleMoveComp,
|
||||
HeroModelComp
|
||||
HeroModelComp,
|
||||
);
|
||||
}
|
||||
|
||||
destroy(): void {
|
||||
this.remove(HeroViewComp);
|
||||
this.remove(HeroModelComp);
|
||||
super.destroy();
|
||||
}
|
||||
hart_load() {
|
||||
@@ -36,7 +37,7 @@ export class Hero extends ecs.Entity {
|
||||
var node = instantiate(prefab);
|
||||
var scene = smc.map.MapView.scene;
|
||||
node.parent = scene.entityLayer!.node!
|
||||
let pos=v3(-277,150,0)
|
||||
let pos=v3(-277,0,0)
|
||||
node.setPosition(pos)
|
||||
var hv = node.getComponent(HeroViewComp)!;
|
||||
hv.scale = 1;
|
||||
@@ -97,31 +98,5 @@ export class Hero extends ecs.Entity {
|
||||
}
|
||||
|
||||
|
||||
// 添加技能
|
||||
public addSkill(skillId: number) {
|
||||
const comp = this.get(HeroSkillsComp);
|
||||
if (comp.skills.indexOf(skillId) === -1) {
|
||||
comp.skills.push(skillId);
|
||||
comp.cooldowns.set(skillId, 0);
|
||||
comp.counters.set(skillId, 0);
|
||||
console.log(`技能${skillId}初始化完成`,
|
||||
'当前cooldowns:', comp.cooldowns,
|
||||
'当前counters:', comp.counters);
|
||||
}
|
||||
}
|
||||
|
||||
// 移除技能
|
||||
public removeSkill(skillId: number) {
|
||||
const comp = this.get(HeroSkillsComp);
|
||||
comp.skills = comp.skills.filter(id => id !== skillId);
|
||||
}
|
||||
|
||||
public levelUp() {
|
||||
// ...升级逻辑...
|
||||
const comp = this.get(HeroSkillsComp);
|
||||
comp.skills.forEach(skillId => {
|
||||
comp.resetCooldown(skillId);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user