You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
846 B
20 lines
846 B
import { director } from 'cc';
|
|
import { ThermalProfile } from '../../game/ThermalProfile';
|
|
import { BattlePresentationBudget } from '../view/BattlePresentationBudget';
|
|
|
|
/**
|
|
* 战斗逻辑降频:目标战斗帧率低于 60 时,部分非关键表现 host 隔帧 tick,减轻 CPU/发热。
|
|
* 核心 session.tick / 命中结算仍每帧执行。
|
|
*/
|
|
export class BattleLogicThrottle {
|
|
/** 是否在本帧执行次要表现 tick(被动特效、部分 host 等) */
|
|
static shouldRunCosmeticHosts(): boolean {
|
|
const tgt = ThermalProfile.current.battleFrameRate;
|
|
const waveHeavy = BattlePresentationBudget.intensityScale < 0.85;
|
|
if (waveHeavy) {
|
|
return (director.getTotalFrames() % 3) === 0;
|
|
}
|
|
if (tgt >= 58) return true;
|
|
return (director.getTotalFrames() & 1) === 0;
|
|
}
|
|
}
|
|
|