perf: 道具支持站位

This commit is contained in:
richarjiang
2025-10-11 14:30:09 +08:00
parent 94fac4f38f
commit 27c30713a9
2 changed files with 17 additions and 7 deletions

View File

@@ -4872,8 +4872,8 @@
"_prefab": null, "_prefab": null,
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -79.18, "x": -150.937,
"y": -44.339, "y": -79.824,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -5292,9 +5292,9 @@
}, },
"_lscale": { "_lscale": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 1, "x": 0.833,
"y": 1, "y": 0.833,
"z": 1 "z": 0.833
}, },
"_mobility": 0, "_mobility": 0,
"_layer": 33554432, "_layer": 33554432,

View File

@@ -607,7 +607,7 @@ export class PlayerController extends Component {
if (otherCollider.node.name.startsWith('guai_')) { if (otherCollider.node.name.startsWith('guai_')) {
void this.handleAttack(selfCollider, otherCollider); void this.handleAttack(selfCollider, otherCollider);
} else if (otherCollider.node.name.startsWith('box_')) { } else if (otherCollider.node.name.startsWith('box_')) {
this.handleBoxCollision(otherCollider); void this.handleBoxCollision(selfCollider, otherCollider);
} }
} }
@@ -918,7 +918,7 @@ export class PlayerController extends Component {
}, 1); // 延迟1秒显示失败弹窗让玩家死亡动画播放完成 }, 1); // 延迟1秒显示失败弹窗让玩家死亡动画播放完成
} }
private handleBoxCollision(otherCollider: Collider2D) { private async handleBoxCollision(selfCollider: Collider2D, otherCollider: Collider2D) {
if (!this.player) { if (!this.player) {
return; return;
} }
@@ -931,6 +931,16 @@ export class PlayerController extends Component {
// 防止重复触发 // 防止重复触发
otherCollider.enabled = false; otherCollider.enabled = false;
this.stopMovement();
await this.alignPlayerForAttack(selfCollider, otherCollider);
if (!this.player || !boxNode.isValid) {
return;
}
this.switchAnimation('stand');
const playerHpNode = this.player.getChildByName('hp'); const playerHpNode = this.player.getChildByName('hp');
const boxHpNode = boxNode.getChildByName('hp'); const boxHpNode = boxNode.getChildByName('hp');