fix(hero): 调整英雄后退逻辑和伤害提示位置

修改英雄后退行为,移除英雄后退功能并增加怪物后退距离
调整伤害提示的垂直位置计算方式,使用传入的y参数
This commit is contained in:
2025-11-03 06:37:51 +08:00
parent 9d42c221fd
commit 1f5792aa99

View File

@@ -211,10 +211,10 @@ export class HeroViewComp extends CCComp {
}
/** 血量提示(伤害数字) */
private hp_tip(type: number = 1, value: string = "", s_uuid: number = 1001, y: number = 90) {
private hp_tip(type: number = 1, value: string = "", s_uuid: number = 1001, y: number = 100) {
let tip = ecs.getEntity<Tooltip>(Tooltip);
let x = this.node.position.x;
let ny = this.node.getComponent(UITransform).height + 60;
let ny = this.node.getComponent(UITransform).height + y;
let pos = v3(x, ny, 0);
tip.load(pos, type, value, s_uuid, this.node.parent);
}
@@ -302,15 +302,16 @@ export class HeroViewComp extends CCComp {
//后退
back(){
if(this.model.fac==FacSet.MON) {
let tx=this.node.position.x+5
let tx=this.node.position.x+30
if(tx > 320) tx=320
tween(this.node).to(0.1, { position:v3(tx,this.node.position.y,0)}).start()
}
if(this.model.fac==FacSet.HERO) {
let tx=this.node.position.x-5
if(tx < -320) tx=-320
tween(this.node).to(0.1, { position:v3(tx,this.node.position.y,0)}).start()
}
//英雄不再后退
// if(this.model.fac==FacSet.HERO) {
// let tx=this.node.position.x-30
// if(tx < -320) tx=-320
// tween(this.node).to(0.1, { position:v3(tx,this.node.position.y,0)}).start()
// }
}
// 伤害计算和战斗逻辑已迁移到 HeroBattleSystem