技能还有错误

This commit is contained in:
2024-08-21 17:55:15 +08:00
parent 76a7854e94
commit ee7f1c322b
7 changed files with 78 additions and 55 deletions

View File

@@ -34,7 +34,7 @@ export class CSkill extends ecs.Entity {
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))
// 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
@@ -44,7 +44,7 @@ export class CSkill extends ecs.Entity {
}
}
console.log("load skill",pos,smc.player_buffs)
// 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))
const url = 'game/heros/skill';

View File

@@ -7,6 +7,7 @@ import { SkillSet } from "../common/config/CardSet";
import { Monster } from "./Monster";
import { MonsterModelComp } from "./MonsterModelComp";
import { MonsterViewComp } from "./MonsterViewComp";
import { BoxSet } from "../common/config/BoxSet";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@@ -44,17 +45,30 @@ export class CSkillComp extends CCComp {
shoot() {
let skill = ecs.getEntity<Skill>(Skill);
let pos = v3(0,0)
let t_pos:Vec3=null
let t_pos = v3(0,0)
let angle = 0
let m_pos=v3(0,0)
let monsters:any = ecs.query(ecs.allOf(MonsterModelComp));
for (const monster of monsters) {
t_pos= monster.getComponent(MonsterViewComp).get_monster_pos()
if (monsters.length > 0) {
m_pos = monsters[0].MonsterView.get_monster_pos()
}else{
m_pos = v3(BoxSet.MONSTER_START,BoxSet.GAME_LINE)
}
t_pos = v3(m_pos.x-this.node.position.x,m_pos.y-this.node.position.y)
// console.log("m_pos",this.node.position,m_pos);
let dx=m_pos.x-this.node.position.x
let dy=m_pos.y-this.node.position.y
let dir=v3(dx,dy,0)
let randian=Math.atan2(dir.y,dir.x)
angle = randian * (180 / Math.PI);
// console.log("angle",angle);
let scale = this.scale
let dis = SkillSet[this.skill_uuid].dis+this.dis;
let atk = SkillSet[this.skill_uuid].atk+this.atk;
let speed = SkillSet[this.skill_uuid].speed+this.speed;
let sp_name = SkillSet[this.skill_uuid].sp_name
skill.load(pos,speed,dis,scale,this.node,sp_name,atk,t_pos);
skill.load(pos,speed,dis,scale,this.node,sp_name,atk,angle,t_pos);
}
/** 全局消息逻辑处理 */
// private onHandler(event: string, args: any) {