fix(英雄属性): 调整英雄锚点位置并修复HP/MP回复逻辑
将英雄hk1的锚点y坐标从0调整为0.2以改善显示效果 使用Timer控制HP/MP回复频率,从每帧改为每秒回复固定值
This commit is contained in:
@@ -902,7 +902,7 @@
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0
|
||||
"y": 0.2
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { Timer } from "db://oops-framework/core/common/timer/Timer";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { Attrs, AttrsType, BType, NeAttrs } from "../common/config/HeroAttrs";
|
||||
@@ -406,7 +407,7 @@ export class HeroAttrSystem extends ecs.ComblockSystem
|
||||
private entityCount: number = 0; // 本帧处理的实体数
|
||||
private frameCount: number = 0; // 总帧数
|
||||
private debugMode: boolean = false; // 是否启用调试模式
|
||||
|
||||
private timer:Timer=new Timer(1)
|
||||
/**
|
||||
* 过滤器:只处理拥有 HeroAttrsComp 的实体
|
||||
*/
|
||||
@@ -455,10 +456,11 @@ export class HeroAttrSystem extends ecs.ComblockSystem
|
||||
|
||||
// 1. 更新临时 Buff/Debuff(时间递减,过期自动移除)
|
||||
model.updateTemporaryBuffsDebuffs(this.dt);
|
||||
|
||||
// 2. HP/MP 自然回复(业务规则)
|
||||
model.mp += HeroUpSet.MP * this.dt/60;
|
||||
model.hp += HeroUpSet.HP * this.dt/60;
|
||||
if(this.timer.update(this.dt)){
|
||||
// 2. HP/MP 自然回复(业务规则)
|
||||
model.mp += HeroUpSet.MP
|
||||
model.hp += HeroUpSet.HP
|
||||
}
|
||||
|
||||
// 3. 限制属性值在合理范围内
|
||||
if (model.mp > model.Attrs[Attrs.MP_MAX]) {
|
||||
|
||||
Reference in New Issue
Block a user