feat: 添加击退效果相关逻辑
1. 新增击退概率、击退距离、击退抗性属性配置 2. 实现击退判定与击退位移逻辑,整合进受击流程 3. 重构后退方法支持自定义击退距离参数
This commit is contained in:
@@ -483,32 +483,35 @@ export class HeroViewComp extends CCComp {
|
||||
private isBackingUp: boolean = false; // 🔥 添加后退状态标记
|
||||
|
||||
//后退
|
||||
back(){
|
||||
back(distance: number = 0){
|
||||
// 🔥 防止重复调用后退动画
|
||||
// if (this.isBackingUp) return;
|
||||
// this.isBackingUp = true; // 🔥 设置后退状态
|
||||
if (this.isBackingUp) return;
|
||||
this.isBackingUp = true; // 🔥 设置后退状态
|
||||
|
||||
// if(this.model.fac==FacSet.MON) {
|
||||
// let tx=this.node.position.x+FightSet.BACK_RANG
|
||||
// if(tx > 320) tx=320
|
||||
// tween(this.node)
|
||||
// .to(0.1, { position:v3(tx,this.node.position.y,0)})
|
||||
// .call(() => {
|
||||
// this.isBackingUp = false; // 🔥 动画完成后重置状态
|
||||
// })
|
||||
// .start()
|
||||
// }
|
||||
if(this.model.fac==FacSet.MON) {
|
||||
// 基础击退距离,加上额外的距离强化
|
||||
let dist = FightSet.BACK_RANG + distance;
|
||||
let tx=this.node.position.x + dist;
|
||||
if(tx > 320) tx=320;
|
||||
tween(this.node)
|
||||
.to(0.1, { position:v3(tx,this.node.position.y,0)})
|
||||
.call(() => {
|
||||
this.isBackingUp = false; // 🔥 动画完成后重置状态
|
||||
})
|
||||
.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)})
|
||||
// .call(() => {
|
||||
// this.isBackingUp = false; // 🔥 动画完成后重置状态
|
||||
// })
|
||||
// .start()
|
||||
// }
|
||||
if(this.model.fac==FacSet.HERO) {
|
||||
let dist = 5 + distance;
|
||||
let tx=this.node.position.x - dist;
|
||||
if(tx < -320) tx=-320;
|
||||
tween(this.node)
|
||||
.to(0.1, { position:v3(tx,this.node.position.y,0)})
|
||||
.call(() => {
|
||||
this.isBackingUp = false; // 🔥 动画完成后重置状态
|
||||
})
|
||||
.start();
|
||||
}
|
||||
}
|
||||
// 伤害计算和战斗逻辑已迁移到 HeroBattleSystem
|
||||
|
||||
|
||||
Reference in New Issue
Block a user