role 也转为使用hero 预制体
This commit is contained in:
@@ -37,7 +37,12 @@ export class CSkill extends ecs.Entity {
|
||||
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))
|
||||
pos = this.add_buff()
|
||||
if(SkillSet[uuid].type >= 90){
|
||||
pos = this.add_buff()
|
||||
}else{
|
||||
pos = this.add_skill()
|
||||
}
|
||||
|
||||
// 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))
|
||||
@@ -52,7 +57,7 @@ export class CSkill extends ecs.Entity {
|
||||
}
|
||||
add_buff(){
|
||||
let pos = v3(0,0,0)
|
||||
for (let index = 0; index < 8; index++) {
|
||||
for (let index = 0; index < 4; index++) {
|
||||
if(smc.player_buffs[index].eid == 0){
|
||||
pos.x=smc.player_buffs[index].x
|
||||
pos.y=smc.player_buffs[index].y
|
||||
@@ -63,6 +68,18 @@ export class CSkill extends ecs.Entity {
|
||||
}
|
||||
return pos
|
||||
}
|
||||
add_skill(){
|
||||
let pos = v3(0,0,0)
|
||||
for (let index = 4; 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;
|
||||
|
||||
Reference in New Issue
Block a user