技能内存优化

This commit is contained in:
2025-08-08 22:20:26 +08:00
parent 570812de88
commit bf241345bf
13 changed files with 3224 additions and 2930 deletions

View File

@@ -188,7 +188,8 @@ export class HeroViewComp extends CCComp {
private damageQueue: Array<{
damage: number,
isCrit: boolean,
delay: number
delay: number,
anm:string,
}> = [];
private isProcessingDamage: boolean = false;
private damageInterval: number = 0.01; // 伤害数字显示间隔
@@ -635,6 +636,7 @@ export class HeroViewComp extends CCComp {
burn_count:number=0,burn_value:number=0,
stun_time:number=0,stun_ratto:number=0,
frost_time:number=0,frost_ratto:number=0,
atked_anm:string="atked"
){
this.do_atked_trigger()
if(burn_count>0){
@@ -660,7 +662,9 @@ export class HeroViewComp extends CCComp {
if(this.currentHp <= 0) {
if(this == null) return;
this.is_dead=true
this.BUFFCOMP.dead()
if(this.BUFFCOMP){
this.BUFFCOMP.dead()
}
this.do_dead()
//console.log("[HeroViewComp]:dead,fac => "+(this.fac==FacSet.HERO?"hero":"monster"))
if(this.ent == null) return;
@@ -670,8 +674,10 @@ export class HeroViewComp extends CCComp {
this.ent.destroy();
}
}
// this.update_vm
this.showDamage(damage, is_crit);
this.showDamage(damage, is_crit,atked_anm);
}
//伤害计算 debuff 易伤
@@ -835,11 +841,12 @@ export class HeroViewComp extends CCComp {
}
/** 显示伤害数字 */
showDamage(damage: number, isCrit: boolean) {
showDamage(damage: number, isCrit: boolean,anm:string="atked") {
this.damageQueue.push({
damage,
isCrit,
delay: this.damageInterval
delay: this.damageInterval,
anm
});
}
ex_show(text:string){
@@ -859,7 +866,7 @@ export class HeroViewComp extends CCComp {
this.isProcessingDamage = true;
const damageInfo = this.damageQueue.shift()!;
this.showDamageImmediate(damageInfo.damage, damageInfo.isCrit);
this.showDamageImmediate(damageInfo.damage, damageInfo.isCrit,damageInfo.anm);
// 设置延时处理下一个伤害
this.scheduleOnce(() => {
@@ -868,9 +875,9 @@ export class HeroViewComp extends CCComp {
}
/** 立即显示伤害效果 */
private showDamageImmediate(damage: number, isCrit: boolean) {
this.as.atked()
// this.BUFFCOMP.in_atked()
private showDamageImmediate(damage: number, isCrit: boolean,anm:string="atked") {
// this.as.atked()
this.BUFFCOMP.in_atked(anm)
this.atked_count++;
if (isCrit) {
this.BUFFCOMP.hp_tip(TooltipTypes.crit, damage.toFixed(0), damage);