|
@@ -100,7 +100,10 @@ export class Enemy extends BaseExp {
|
|
|
//运动方向
|
|
|
public moveDir: Vec3 = new Vec3();
|
|
|
//设置的血量
|
|
|
- public totalHP: number = 0;
|
|
|
+ public curHP: number = 0;
|
|
|
+ //敌人的原始血量
|
|
|
+ public originHP: number = 0;
|
|
|
+
|
|
|
//是否是没打死逃逸
|
|
|
public escape: boolean = false;
|
|
|
//敌人数据
|
|
@@ -150,7 +153,7 @@ export class Enemy extends BaseExp {
|
|
|
this.isDead = false;
|
|
|
this.escape = false;
|
|
|
//设置血量
|
|
|
- this.totalHP = data.hp;
|
|
|
+ this.curHP = this.originHP = data.hp;
|
|
|
//敌人速度
|
|
|
const s: number = data.speed * 3;
|
|
|
this.speed = s;
|
|
@@ -249,23 +252,23 @@ export class Enemy extends BaseExp {
|
|
|
if(Game.I.isPause
|
|
|
||this.isDead
|
|
|
||hp == null
|
|
|
- ||this.totalHP <= 0){
|
|
|
+ ||this.curHP <= 0){
|
|
|
return;
|
|
|
}
|
|
|
this.hpBar.node.active = true;
|
|
|
this.scheduleOnce(() => {
|
|
|
if(this.hpBar){this.hpBar.node.active = false;}
|
|
|
}, 0.8);
|
|
|
- this.totalHP -= hp;
|
|
|
+ this.curHP -= hp;
|
|
|
//这种是伤害超级高直接死亡了
|
|
|
- if(hp > this.totalHP){
|
|
|
+ if(hp > this.originHP){
|
|
|
this.escape = false;
|
|
|
this.showHurt(Utils.numberToString(hp));
|
|
|
this.recycle()
|
|
|
return;
|
|
|
}
|
|
|
//敌人死亡
|
|
|
- if(this.totalHP <= 0 && !this.isDead){
|
|
|
+ if(this.curHP <= 0 && !this.isDead){
|
|
|
//爆头击杀播放音效
|
|
|
if(isHeadShot){
|
|
|
audioMgr.playOneShot(Constants.audios.head_shot);
|
|
@@ -273,7 +276,7 @@ export class Enemy extends BaseExp {
|
|
|
this.escape = false;
|
|
|
this.recycle();
|
|
|
}else{//进度条和单独扣血
|
|
|
- this.hpBar.progress = this.totalHP / this.data.hp;
|
|
|
+ this.hpBar.progress = this.curHP / this.originHP;
|
|
|
this.showHurt(Utils.numberToString(hp));
|
|
|
}
|
|
|
}
|
|
@@ -326,7 +329,7 @@ export class Enemy extends BaseExp {
|
|
|
return;
|
|
|
};
|
|
|
this.removeGun();
|
|
|
- this.totalHP = 0;
|
|
|
+ this.curHP = 0;
|
|
|
if(!this.isTank()){
|
|
|
this.skeletalAnim.play(EAnimType.die);
|
|
|
}
|
|
@@ -438,7 +441,7 @@ export class Enemy extends BaseExp {
|
|
|
};
|
|
|
const data:any = this.getDifficultyData();
|
|
|
if(data.hp_ratio > 0){
|
|
|
- this.totalHP = this.data.hp * (1 + data.hp_ratio);
|
|
|
+ this.curHP += this.originHP * data.hp_ratio;
|
|
|
}
|
|
|
}
|
|
|
|