战斗管理系统基础

This commit is contained in:
2025-02-03 22:02:26 +08:00
parent 060046a6a6
commit 36a8aff783
27 changed files with 375 additions and 619 deletions

View File

@@ -14,6 +14,7 @@ import { BuffComp } from "./BuffComp";
import { MonModelComp } from "./MonModelComp";
import { getMonsterDrops, MonsterType } from "../common/config/RewardSet";
import { HeroSkillsComp } from "../skill/heroSkillsComp";
import { DamageResult } from "../damage/DamageComp";
const { ccclass, property } = _decorator;
@@ -149,16 +150,19 @@ export class HeroViewComp extends CCComp {
this.in_stop(dt);
}
get isActive() {
return this.ent.has(HeroViewComp) && this.node?.isValid;
}
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
if(this.hp == this.hp_max){
this.node.getChildByName("top").getChildByName("hp").active = false;
} else{
this.node.getChildByName("top").getChildByName("hp").active = true;
}
this.node.getChildByName("top").getChildByName("hp").active = true;
// if(this.hp == this.hp_max){
// this.node.getChildByName("top").getChildByName("hp").active = false;
// } else{
// this.node.getChildByName("top").getChildByName("hp").active = true;
// }
}
//移动
@@ -561,13 +565,24 @@ export class HeroViewComp extends CCComp {
const skills = this.ent.get(HeroSkillsComp);
skills.resetAllCooldowns();
}
applyDamage(result:DamageResult){
}
/** 显示伤害数字 */
showDamage(damage: number, isCrit: boolean) {
if(!this.BUFFCOMP.isValid){
return;
}
if(isCrit){
this.BUFFCOMP.tooltip(4,damage.toFixed(0),damage)
console.log("暴击伤害:"+damage)
}else{
this.BUFFCOMP.tooltip(1,damage.toFixed(0),damage)
console.log("普通伤害:"+damage)
}
}
}