需要修复 英雄目标错误

This commit is contained in:
2024-09-18 17:45:23 +08:00
parent 2ab7279b04
commit 01ad8b619e
17 changed files with 834 additions and 1723 deletions

View File

@@ -18,7 +18,7 @@ const { ccclass, property } = _decorator;
export class RoleSpine extends Component {
private loop: boolean = true;
private spine!: sp.Skeleton;
private default:string = "move";
private default:string = "idle";
private atk_name: string = "atk";
private move_name: string = "move";
private max_name: string = "max";
@@ -32,17 +32,16 @@ export class RoleSpine extends Component {
this.spine = this.node.getChildByName("anm")!.getComponent(sp.Skeleton);
this.spine.setEndListener(trackEntry => {
var animationName = trackEntry.animation ? trackEntry.animation.name : "";
console.log("[track %s][animation %s] end.", trackEntry.trackIndex, animationName);
// if (animationName == "atk" || animationName== "max" ) {
// this.spine.setAnimation(0, this.default, true);
// }
// console.log("[track %s][animation %s] end.", trackEntry.trackIndex, animationName);
if (animationName == "atk" || animationName== "max" ) {
this.spine.setAnimation(0, this.default, true);
}
});
}
protected play(animName: string, loop: boolean) {
}
atk(){
this.spine.setAnimation(0, this.atk_name, false);
}
idle(){

View File

@@ -91,7 +91,7 @@ export class RoleViewComp extends CCComp {
is_dead:boolean = false; //是否摧毁
is_stop:boolean = false;
is_atking:boolean = false;
type:number = 0;
onLoad() {
// this.BoxRang = this.node.getChildByName("range_box");
this.as = this.node.getComponent(RoleSpine);
@@ -182,7 +182,8 @@ export class RoleViewComp extends CCComp {
this.check_buff_atks(dt)
this.in_shield(dt);
this.in_stop(dt);
this.in_atk(dt);
this.atk_time += dt;
this.in_atk();
// this.move();
this.check_enemys()
}
@@ -259,7 +260,7 @@ export class RoleViewComp extends CCComp {
return false
}
}
in_atk(dt: number) {
in_atk() {
if(this.atk_time >= this.atk_cd){
// if(this.is_atking&&this.check_enemy_alive()){
// this.atk_time = 0;
@@ -273,11 +274,10 @@ export class RoleViewComp extends CCComp {
this.as.atk();
this.scheduleOnce(()=>{
this.shoot(this.skill,-30);
},0.4)
}else{
this.atk_time += dt;
},0.2)
}
}
hp_change(hp: number){
if(this.is_dead){
return;