This commit is contained in:
2024-08-26 10:14:53 +08:00
parent 4f96558d36
commit 4f64af7848
13 changed files with 176 additions and 286 deletions

View File

@@ -4,11 +4,13 @@ import { CSkillComp } from "./CSkillComp";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { smc } from "../common/SingletonModuleComp";
import { SkillSet } from "../common/config/SkillSet";
import { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer";
/** CSkill 模块 */
@ecs.register(`CSkill`)
export class CSkill extends ecs.Entity {
CSkillView!: CSkillComp;
/** 实始添加的数据层组件 */
protected init() {
@@ -28,22 +30,14 @@ export class CSkill extends ecs.Entity {
load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001) {
// var path = "game/monster/"+prefab_path;
// console.log("load skill",this)
var path = "game/heros/skill";
var path = "game/heros/cskill";
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
var scene = smc.map.MapView.scene;
node.parent = scene.entityLayer!.node!;
node.getChildByName("skill").setScale(node.getChildByName("skill").scale.x*scale, node.getChildByName("skill").scale.y, node.getChildByName("skill").scale.z);
// let cskills = ecs.query(ecs.allOf(CSkillComp))
for (let index = 1; index <= 8; index++) {
if(smc.player_buffs[index].eid == 0){
pos.x=smc.player_buffs[index].x
pos.y=smc.player_buffs[index].y
smc.player_buffs[index].eid=this.eid
break
}
}
pos = this.add_buff()
// console.log("load skill",pos,smc.player_buffs)
node.setPosition(pos.x*scale,pos.y,pos.z)
// console.log(node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite))
@@ -56,7 +50,19 @@ export class CSkill extends ecs.Entity {
oops.message.dispatchEvent("cskill_load",this)
}
add_buff(){
let pos = v3(0,0,0)
for (let index = 0; index < 8; index++) {
if(smc.player_buffs[index].eid == 0){
pos.x=smc.player_buffs[index].x
pos.y=smc.player_buffs[index].y
smc.player_buffs[index].eid=this.eid
break
}
}
return pos
}
skill_init(uuid:number=1001,node:Node,pos:Vec3=v3(0,0,0)){
var mv = node.getComponent(CSkillComp)
mv.scale = 1;