英雄和敌人 全死亡后,判定解决
This commit is contained in:
@@ -122,6 +122,7 @@ export class HeroViewComp extends CCComp {
|
||||
//console.log("[HeroViewComp]:hero view comp ",this.FIGHTCON)
|
||||
this.on(GameEvent.EXPUP,this.exp_up,this)
|
||||
this.on(GameEvent.HeroLvUp,this.to_update_lv,this)
|
||||
this.on(GameEvent.FightEnd,this.do_fight_end,this)
|
||||
const collider = this.node.getComponent(BoxCollider2D);
|
||||
this.scheduleOnce(()=>{
|
||||
if (collider) collider.enabled = true; // 先禁用
|
||||
@@ -142,7 +143,6 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
/* 显示角色血量 */
|
||||
this.node.getChildByName("top").getChildByName("hp").active = true;
|
||||
|
||||
}
|
||||
|
||||
update(dt: number){
|
||||
@@ -151,7 +151,6 @@ export class HeroViewComp extends CCComp {
|
||||
// this.ent.destroy();
|
||||
// return
|
||||
// }
|
||||
|
||||
|
||||
if(this.DEBUFF_FROST > 0){
|
||||
this.DEBUFF_FROST -=dt;
|
||||
@@ -175,8 +174,10 @@ export class HeroViewComp extends CCComp {
|
||||
this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar).progress = hp_progress;
|
||||
// this.node.getChildByName("top").getChildByName("hp").active = (hp == hp_max) ? false : true;
|
||||
}
|
||||
do_fight_end(){
|
||||
this.as.do_buff()
|
||||
}
|
||||
|
||||
|
||||
get isActive() {
|
||||
return this.ent.has(HeroViewComp) && this.node?.isValid;
|
||||
}
|
||||
@@ -255,14 +256,15 @@ export class HeroViewComp extends CCComp {
|
||||
do_dead(){
|
||||
this.do_dead_trigger()
|
||||
//console.log("[HeroViewComp]:角色死亡",this.hero_uuid)
|
||||
|
||||
if(this.is_count_dead) return
|
||||
this.is_count_dead=true
|
||||
if(this.fac==FacSet.MON){
|
||||
if(this.is_count_dead) return
|
||||
this.is_count_dead=true
|
||||
this.scheduleOnce(()=>{
|
||||
oops.message.dispatchEvent(GameEvent.MonDead)
|
||||
},0.1)
|
||||
|
||||
},0.1)
|
||||
}
|
||||
if(this.fac==FacSet.HERO){
|
||||
oops.message.dispatchEvent(GameEvent.HeroDead)
|
||||
}
|
||||
|
||||
if(this.fac==FacSet.HERO){
|
||||
@@ -479,7 +481,6 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
|
||||
check_dodge(){
|
||||
if(this.fac==FacSet.HERO) smc.vmdata.hero.power+=smc.vmdata.hero.POWER_UP+FightSet.DODGE_TO_POWER //闪避涨能量
|
||||
if(this.dod > 0){
|
||||
let random = Math.random()*100
|
||||
if(random < this.dod) {
|
||||
@@ -567,15 +568,7 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
|
||||
exp_up(e:any,data:any){
|
||||
if(this.fac==FacSet.MON) return
|
||||
// console.log("[HeroViewComp]:经验提高",data.exp)
|
||||
smc.vmdata.hero.exp+=data.exp
|
||||
// smc.vmdata.hero.next_exp=getUpExp(this.lv)
|
||||
if(smc.vmdata.hero.exp >= smc.vmdata.hero.next_exp){
|
||||
// console.log("[HeroViewComp]:升级")
|
||||
this.to_update_lv("seft",data)
|
||||
oops.message.dispatchEvent(GameEvent.CanUpdateLv)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user