46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
import { _decorator, Label, ProgressBar, resources, Sprite, SpriteAtlas, v3, Vec3 } from "cc";
|
|
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
|
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
|
import { SkillSet } from "../common/config/SkillSet";
|
|
import { BoxSet } from "../common/config/BoxSet";
|
|
import { smc } from "../common/SingletonModuleComp";
|
|
import { Skill } from "../skills/Skill";
|
|
|
|
const { ccclass, property } = _decorator;
|
|
|
|
/** 视图层对象 */
|
|
@ccclass('MSkillComp')
|
|
@ecs.register('MSkillComp', false)
|
|
export class MSkillComp extends CCComp {
|
|
|
|
/** 视图层逻辑代码分离演示 */
|
|
start() {
|
|
}
|
|
init(){
|
|
|
|
|
|
}
|
|
protected update(dt: number): void {
|
|
if(!smc.mission.play||smc.mission.pause){
|
|
return
|
|
}
|
|
}
|
|
|
|
private doSkill(config: typeof SkillSet[keyof typeof SkillSet]) {
|
|
const skillEntity = ecs.getEntity<Skill>(Skill);
|
|
const start_pos=v3(0,0)
|
|
const target_pos=v3(0,0)
|
|
skillEntity.load(
|
|
start_pos, // 起始位置
|
|
BoxSet.HERO, // 阵营
|
|
this.node.parent, // 父节点
|
|
config.uuid, // 技能ID
|
|
target_pos, // 目标位置
|
|
);
|
|
}
|
|
|
|
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
|
reset() {
|
|
|
|
}
|
|
} |