加血技能完成 怪物动画减少

This commit is contained in:
walkpan
2024-09-15 23:25:34 +08:00
parent 417b5d85be
commit 2095393757
317 changed files with 36222 additions and 60962 deletions

View File

@@ -71,9 +71,9 @@ export class BoxRangComp extends CCComp {
}
}
if(Math.abs(other_pos.x-self_pos.x) < this.MonViewComp.atk_dis){
this.MonViewComp.is_atking = true;
this.MonViewComp.stop_cd = 0.1
this.MonViewComp.as.change_default("idle");
}

View File

@@ -17,9 +17,7 @@ const { ccclass, property } = _decorator;
export class MonSpine extends Component {
@property(Animation)
animator: Animation = null!;
idle_clip: AnimationClip = null!;
atk_clip: AnimationClip = null!;
max_clip: AnimationClip = null!;
move_clip: AnimationClip = null!;
default_clip:string = "move";
@@ -27,10 +25,8 @@ export class MonSpine extends Component {
// 角色控制组件
this.initAnimator();
LayerUtil.setNodeLayer(LayerUtil.MAP, this.node);
this.idle_clip = this.animator.clips[0];
this.atk_clip = this.animator.clips[1];
this.max_clip = this.animator.clips[2];
this.move_clip = this.animator.clips[3];
this.atk_clip = this.animator.clips[0];
this.move_clip = this.animator.clips[1];
let animation = this.animator.getComponent(Animation);
animation.on(Animation.EventType.FINISHED, this.onAnimationEvent, this)
}
@@ -43,7 +39,7 @@ export class MonSpine extends Component {
onAnimationEvent(type: Animation.EventType, state: AnimationState){
if(type==Animation.EventType.FINISHED){
if(state.name==this.atk_clip.name||state.name==this.max_clip.name){
if(state.name==this.atk_clip.name){
this.default();
}
}
@@ -57,8 +53,8 @@ export class MonSpine extends Component {
}
}
idle(){
if(!this.animator.getState(this.idle_clip.name).isPlaying){
this.animator.play(this.idle_clip.name);
if(!this.animator.getState(this.move_clip.name).isPlaying){
this.animator.play(this.move_clip.name);
}
}
atk() {
@@ -69,8 +65,8 @@ export class MonSpine extends Component {
max(){
if(!this.animator.getState(this.max_clip.name).isPlaying){
this.animator.play(this.max_clip.name);
if(!this.animator.getState(this.atk_clip.name).isPlaying){
this.animator.play(this.atk_clip.name);
}
}

View File

@@ -175,7 +175,7 @@ export class MonViewComp extends CCComp {
if(this.scale===-1&&this.node.position.x <= BoxSet.HERO_START){
return;
}
this.set_diry()
// this.set_diry()
this.node.setPosition(this.node.position.x+dt*this.speed*this.scale, this.node.position.y+dt*this.dir_y, this.node.position.z);
}
set_diry(){
@@ -200,26 +200,21 @@ export class MonViewComp extends CCComp {
// let power_progress= this.power/this.power_max;
// this.node.getChildByName("top").getChildByName("power").getComponent(ProgressBar)!.progress = power_progress;
}
shoot(skill_uuid:number){
shoot(skill_uuid:number,y:number=0,x:number=0){
// console.log("mon shoot");
let skill = ecs.getEntity<Skill>(Skill);
let scale = this.scale
let speed =smc.skills[skill_uuid].speed;
let dis = smc.skills[skill_uuid].dis;
let atk = smc.skills[skill_uuid].atk+this.atk;
let {pos,angle,t_pos}=this.get_enemy_pos()
skill.load(pos,speed,dis,scale,this.node,skill_uuid,atk,angle,t_pos);
pos.y=pos.y + y
pos.x=pos.x + x
skill.load(pos,BoxSet.MONSTER,this.node,skill_uuid,atk,t_pos);
// this.tooltip(3,smc.skills[skill_uuid].name,this.skill_uuid);
}
//使用max_skill
do_max_skill(){
let skill = ecs.getEntity<Skill>(Skill);
let scale = this.scale
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;
let {pos,angle,t_pos}=this.get_enemy_pos()
skill.load(pos,speed,dis,scale,this.node,this.max_skill_uuid,atk,angle,t_pos);
for(let i=0;i<smc.skills[this.max_skill_uuid].count;i++){
this.shoot(this.max_skill_uuid)
}
}
to_speek(words:string,time:number=0.5){
this.speek_time=0.5
@@ -247,12 +242,8 @@ export class MonViewComp extends CCComp {
return
}
t_pos = v3(this.enemy.position.x-(this.node.position.x+pos.x)*1.1,(this.enemy.position.y-(this.node.position.y+pos.y)+BoxSet.ATK_Y)*1.1)
angle = Math.atan2(t_pos.y,t_pos.x) * 180 / Math.PI;
if(this.scale == -1){
angle = angle +180
}
}else{
t_pos=null
t_pos=v3(-720,BoxSet.GAME_LINE)
}
return {pos,t_pos,angle}
}
@@ -261,7 +252,8 @@ export class MonViewComp extends CCComp {
if(!this.enemy.isValid){
return false
}
return true
if(Math.abs(this.enemy.position.x-this.node.position.x) < this.atk_dis) return true;
return false
}else{
return false
}