技能运动需要完善

This commit is contained in:
2024-09-12 11:14:37 +08:00
parent a847611240
commit 1c9aa38385
212 changed files with 531 additions and 62599 deletions

View File

@@ -65,6 +65,7 @@ export class BoxRangComp extends CCComp {
}else{
if(this.HeroViewComp.enemy.isValid==false){
this.HeroViewComp.enemy = otherCollider.node;
}
}
this.HeroViewComp.is_atking = true;

View File

@@ -81,6 +81,7 @@ export class Hero extends ecs.Entity {
mv.atk_cd = smc.heros[uuid].atk_cd;
mv.atk_dis = smc.heros[uuid].atk_dis;
mv.power = smc.heros[uuid].power;
mv.power_max= smc.heros[uuid].power_max;
mv.type = smc.heros[uuid].type;
mv.skill_uuid = 9001;
mv.max_skill_uuid = smc.heros[uuid].max_skill_uuid;

View File

@@ -21,6 +21,7 @@ import { SkillSet } from "../common/config/SkillSet";
import { Tooltip } from "../skills/Tooltip";
import { MoveToComp } from "../common/ecs/position/MoveTo";
import { BoxRangComp } from "./BoxRangComp";
import { MonViewComp } from "../mon/MonViewComp";
const { ccclass, property } = _decorator;
/** 角色显示组件 */
@@ -224,7 +225,9 @@ export class HeroViewComp extends CCComp {
this.node.getChildByName("top").getChildByName("power").getComponent(ProgressBar)!.progress = power_progress;
}
shoot(skill_uuid:number){
// console.log("mon shoot");
console.log("hero shoot");
console.log(this.enemy)
console.log("hero box",this.enemy.getComponent(MonViewComp))
let skill = ecs.getEntity<Skill>(Skill);
let x=32
let pos = v3(35*this.scale,50)
@@ -234,11 +237,13 @@ export class HeroViewComp extends CCComp {
let atk = smc.skills[skill_uuid].atk+this.atk;
let angle=0
let t_pos:Vec3 = v3(0,0)
let eid = 0
if(this.enemy){
if(!this.enemy.isValid){
console.log("move_to",this.enemy.isValid);
return
}
eid = this.enemy.getComponent(MonViewComp).ent.eid
t_pos = v3(this.enemy.position.x-this.node.position.x,this.enemy.position.y-this.node.position.y)
angle = Math.atan2(t_pos.y,t_pos.x) * 180 / Math.PI;
if(this.scale == -1){
@@ -247,7 +252,8 @@ export class HeroViewComp extends CCComp {
}else{
t_pos=null
}
skill.load(pos,speed,dis,scale,this.node,skill_uuid,atk,angle,t_pos);
skill.load(eid,this.enemy,pos,speed,dis,scale,this.node,skill_uuid,atk,angle,t_pos);
// this.tooltip(3,smc.skills[skill_uuid].name,this.skill_uuid);
}
//使用max_skill
@@ -259,8 +265,14 @@ export class HeroViewComp extends CCComp {
let speed =smc.skills[this.max_skill_uuid].speed;
let dis = smc.skills[this.max_skill_uuid].dis;
let atk = smc.skills[this.max_skill_uuid].atk+this.atk;
skill.load(pos,speed,dis,scale,this.node,this.max_skill_uuid,atk);
this.tooltip(3,smc.skills[this.max_skill_uuid].name,this.max_skill_uuid);
let eid = 0
if(this.enemy){
if(this.enemy.isValid){
eid = this.enemy.getComponent(MonViewComp).ent.eid
}
}
skill.load(eid,this.enemy,pos,speed,dis,scale,this.node,this.max_skill_uuid,atk);
this.tooltip(3,smc.skills[this.max_skill_uuid].name,this.max_skill_uuid,100);
}
in_act(dt: number) {
if(this.atk_time >= this.atk_cd){
@@ -372,12 +384,12 @@ export class HeroViewComp extends CCComp {
this.node.getChildByName("top").getChildByName("shield").active=true
}
}
tooltip(type:number=1,value:string="",s_uuid:number=1001){
tooltip(type:number=1,value:string="",s_uuid:number=1001,y:number=60){
// console.log("tooltip",type);
let tip =ecs.getEntity<Tooltip>(Tooltip);
let pos = this.node.getPosition();
let node =this.node.parent
pos.y=pos.y+60;
pos.y=pos.y+y;
tip.load(pos,type,value,s_uuid,node);
}