战斗等级显示需要完善
This commit is contained in:
@@ -44,7 +44,7 @@ export class BuffComp extends Component {
|
||||
|
||||
update(deltaTime: number) {
|
||||
if(smc.mission.pause) return
|
||||
this.hp_show()
|
||||
// this.hp_show()
|
||||
if(this.wind_cd > 0 ) this.wind_cd -= deltaTime;
|
||||
if(this.wind_cd <= 0 && this.node.getChildByName("wind").active){
|
||||
this.node.getChildByName("wind").active = false;
|
||||
@@ -59,12 +59,18 @@ export class BuffComp extends Component {
|
||||
|
||||
}
|
||||
hp_show(){
|
||||
let hp=this.node.getComponent(HeroViewComp).hp;
|
||||
let hp_max=this.node.getComponent(HeroViewComp).hp_max;
|
||||
let hp_progress= hp/hp_max;
|
||||
this.top_node.getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
|
||||
if(this.node.getComponent(HeroViewComp).is_boss) return
|
||||
this.top_node.getChildByName("hp").active = (hp == hp_max) ? false : true;
|
||||
if(this.node.getComponent(HeroViewComp).fac == 0) {
|
||||
this.update_info_hp()
|
||||
}else{
|
||||
let hp=this.node.getComponent(HeroViewComp).hp;
|
||||
let hp_max=this.node.getComponent(HeroViewComp).hp_max;
|
||||
let hp_progress= hp/hp_max;
|
||||
this.top_node.getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
|
||||
if(this.node.getComponent(HeroViewComp).is_boss) return
|
||||
this.top_node.getChildByName("hp").active = (hp == hp_max) ? false : true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
show_shield(val:boolean){
|
||||
this.node.getChildByName("shielded").active=val
|
||||
|
||||
@@ -254,6 +254,28 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
do_dead(){
|
||||
|
||||
}
|
||||
do_atked(remainingDamage:number){
|
||||
if (this.shield > 0) {
|
||||
this.shield -= 1
|
||||
this.BUFFCOMP.tooltip(5,"*吸收*");
|
||||
remainingDamage = 0
|
||||
if (this.shield <= 0) {
|
||||
if(this == null) return;
|
||||
this.BUFFCOMP.show_shield(false);
|
||||
}
|
||||
}else{
|
||||
if(this == null) return;
|
||||
this.hp -= remainingDamage;
|
||||
if(this.hp <= 0) {
|
||||
if(this == null) return;
|
||||
this.BUFFCOMP.dead()
|
||||
if(this.ent == null) return;
|
||||
this.ent.destroy();
|
||||
}
|
||||
this.BUFFCOMP.hp_show()
|
||||
this.showDamage(remainingDamage, true);
|
||||
}
|
||||
}
|
||||
dead(){
|
||||
this.BUFFCOMP.dead()
|
||||
|
||||
Reference in New Issue
Block a user