加hp 有问题
This commit is contained in:
@@ -86,6 +86,8 @@ export class HeroViewComp extends CCComp {
|
||||
}> = [];
|
||||
private isProcessingDamage: boolean = false;
|
||||
private damageInterval: number = 0.2; // 伤害数字显示间隔
|
||||
|
||||
private timer:Timer=new Timer(1);
|
||||
|
||||
onLoad() {
|
||||
this.as = this.getComponent(HeroSpine);
|
||||
@@ -131,7 +133,10 @@ export class HeroViewComp extends CCComp {
|
||||
// this.ent.destroy();
|
||||
// return
|
||||
// }
|
||||
this.hp_show()
|
||||
if(this.timer.update(dt)){
|
||||
this.add_ap(10)
|
||||
this.add_hp_max(20)
|
||||
};
|
||||
if(this.ice_cd > 0){
|
||||
this.ice_cd -=dt;
|
||||
return
|
||||
@@ -153,16 +158,7 @@ export class HeroViewComp extends CCComp {
|
||||
this.node.getChildByName("top").getChildByName("ihp").active = false;
|
||||
this.node.getChildByName("top").getChildByName("iap").active = false;
|
||||
}
|
||||
hp_show(){
|
||||
let hp_progress= this.hp/this.hp_max;
|
||||
this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
|
||||
if(this.is_boss) return
|
||||
this.node.getChildByName("top").getChildByName("hp").active = (this.hp == this.hp_max) ? false : true;
|
||||
|
||||
}
|
||||
//移动
|
||||
|
||||
//状态切换
|
||||
//状态切换
|
||||
status_change(type:string){
|
||||
this.status=type
|
||||
if(type == "idle"){
|
||||
@@ -190,33 +186,25 @@ export class HeroViewComp extends CCComp {
|
||||
*/
|
||||
add_ap(ap: number){
|
||||
this.ap += Math.floor(ap);
|
||||
this.BUFFCOMP.buff_get("ap")
|
||||
this.BUFFCOMP.update_info_ap()
|
||||
}
|
||||
|
||||
de_ap(ap: number){
|
||||
this.ap -= Math.floor(ap);
|
||||
this.BUFFCOMP.buff_get("deap")
|
||||
}
|
||||
/**
|
||||
* 增加英雄的闪避率。
|
||||
* @param dodge 要增加的闪避率。
|
||||
*/
|
||||
add_dodge(dodgeRate: number) {
|
||||
this.dodge += Math.floor(dodgeRate);
|
||||
this.BUFFCOMP.buff_get("dodge");
|
||||
}
|
||||
de_dodge(dodgeRate: number) {
|
||||
this.dodge += Math.floor(dodgeRate);
|
||||
this.BUFFCOMP.buff_get("dedodge");
|
||||
this.BUFFCOMP.update_info_ap()
|
||||
}
|
||||
|
||||
add_hp_max(hprate: number=0){
|
||||
this.BUFFCOMP.buff_get("hp")
|
||||
this.hp_max += Math.floor(hprate/100*this.hp_max) ;
|
||||
this.hp_max += Math.floor(hprate) ;
|
||||
this.add_hp2(hprate)
|
||||
this.BUFFCOMP.update_info_hp()
|
||||
}
|
||||
|
||||
de_hp_max(hprate: number=0){
|
||||
this.BUFFCOMP.buff_get("dehp")
|
||||
this.hp_max -= Math.floor(hprate/100*this.hp_max) ;
|
||||
this.hp_max -= Math.floor(hprate) ;
|
||||
this.BUFFCOMP.update_info_hp()
|
||||
}
|
||||
|
||||
add_hp(hp: number = 0) {
|
||||
this.BUFFCOMP.heathed();
|
||||
this.hp+=Math.floor(hp);
|
||||
|
||||
Reference in New Issue
Block a user