feat(combat): 新增战斗距离调整与位置对齐逻辑

- 在场景与脚本中增加 attackPreferredDistance / attackDistanceTolerance 配置
- 碰撞后自动停止移动并调度 adjustPositionsForAttack,确保玩家与怪物保持理想水平距离
- 统一 Y 轴居中,限制在地图边界内,并强制玩家位于右侧
- 优化攻击动画触发,仅播放 attack3 并依据最终朝向设置 direction
- 增加日志输出便于调试最终距离与误差
This commit is contained in:
richarjiang
2025-09-30 17:19:20 +08:00
parent a19a3d07a9
commit cce130755c
2 changed files with 129 additions and 9 deletions

View File

@@ -1915,6 +1915,8 @@
"moveSpeed": 300,
"mapWidth": 1080,
"mapHeight": 1920,
"attackPreferredDistance": 220,
"attackDistanceTolerance": 10,
"_id": "c1AuAU3IlKnLOzgk9vsBr4"
},
{
@@ -4106,8 +4108,8 @@
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 265.122,
"y": -426.369,
"x": 313.621,
"y": -435.009,
"z": 0
},
"_lrot": {
@@ -4558,13 +4560,13 @@
"_restitution": 0,
"_offset": {
"__type__": "cc.Vec2",
"x": 2.5,
"y": -2.4
"x": -8.8,
"y": 2.4
},
"_size": {
"__type__": "cc.Size",
"width": 41.4,
"height": 96.6
"width": 63.9,
"height": 128.4
},
"_id": "b3AIQdLypA3YoQsfzhSOs1"
},