41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
import { instantiate, Prefab, v3 } from "cc";
|
|
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
|
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
|
import { MSkillComp } from "./MSkillComp";
|
|
import { smc } from "../common/SingletonModuleComp";
|
|
import { BoxSet } from "../common/config/BoxSet";
|
|
|
|
/** MSkill 模块 */
|
|
@ecs.register(`MSkill`)
|
|
export class MSkill extends ecs.Entity {
|
|
|
|
|
|
/** 实始添加的数据层组件 */
|
|
protected init() {
|
|
// this.addComponents<ecs.Comp>();
|
|
}
|
|
load(box_group:number=0,uuid:number=1001) {
|
|
var path = "game/heros/mskill";
|
|
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
|
var node = instantiate(prefab);
|
|
let entityLayer =smc.map.MapView.scene.entityLayer!.node!
|
|
node.parent = entityLayer
|
|
let pos=v3(-300,245)
|
|
if(box_group==BoxSet.MONSTER){
|
|
pos.x=300
|
|
// node.setScale(-1,1)
|
|
}
|
|
node.setPosition(pos)
|
|
var msc = node.getComponent(MSkillComp)!;
|
|
msc.msk_uuid = uuid
|
|
msc.box_group = box_group
|
|
this.add(msc)
|
|
}
|
|
/** 模块资源释放 */
|
|
destroy() {
|
|
// 注: 自定义释放逻辑,视图层实现 ecs.IComp 接口的 ecs 组件需要手动释放
|
|
super.destroy();
|
|
}
|
|
}
|
|
|