perf: 道具支持站位
This commit is contained in:
@@ -607,7 +607,7 @@ export class PlayerController extends Component {
|
||||
if (otherCollider.node.name.startsWith('guai_')) {
|
||||
void this.handleAttack(selfCollider, otherCollider);
|
||||
} 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秒显示失败弹窗,让玩家死亡动画播放完成
|
||||
}
|
||||
|
||||
private handleBoxCollision(otherCollider: Collider2D) {
|
||||
private async handleBoxCollision(selfCollider: Collider2D, otherCollider: Collider2D) {
|
||||
if (!this.player) {
|
||||
return;
|
||||
}
|
||||
@@ -931,6 +931,16 @@ export class PlayerController extends Component {
|
||||
// 防止重复触发
|
||||
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 boxHpNode = boxNode.getChildByName('hp');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user