|
@@ -131,7 +131,8 @@ export class TornadoAIComponent extends TornadoComponent {
|
|
|
this.setPositionByObstacle(event, () => {
|
|
|
this.decideAction();
|
|
|
});
|
|
|
- } else if (event.otherCollider.getGroup() === 1 << 3) {
|
|
|
+ }
|
|
|
+ else if (event.otherCollider.getGroup() === 1 << 3) {
|
|
|
if (event.otherCollider.node.name == 'radiusTigger') return;
|
|
|
|
|
|
const otherCollider = event.otherCollider;
|
|
@@ -163,34 +164,34 @@ export class TornadoAIComponent extends TornadoComponent {
|
|
|
if (GameMgr.inst.getGameStatus() != GameStatus.Playing) return;
|
|
|
super.onTriggerStay(event);
|
|
|
|
|
|
- const otherCollider = event.otherCollider;
|
|
|
- if (event.otherCollider.getGroup() === 1 << 3) {
|
|
|
- const targetTornado = otherCollider.node.parent.getComponent(TornadoComponent);
|
|
|
- if (!targetTornado) return;
|
|
|
-
|
|
|
- if (event.selfCollider.node.name == 'RigibodyStorm') {
|
|
|
- if (event.otherCollider.node.name == 'RigibodyStorm') {
|
|
|
- const distance = Vec3.distance(event.selfCollider.node.worldPosition, otherCollider.node.worldPosition);
|
|
|
-
|
|
|
- // 增加碰撞检测的容差范围
|
|
|
- const collisionThreshold = 3; // 增加检测范围
|
|
|
- if (distance <= collisionThreshold) {
|
|
|
- // 添加额外的速度检查,确保不会因为速度太快而错过碰撞
|
|
|
- const relativeSpeed = Math.abs(this.speed - targetTornado.speed);
|
|
|
- const minSpeedThreshold = 5; // 最小速度阈值
|
|
|
-
|
|
|
- if (relativeSpeed >= minSpeedThreshold || distance <= 1.5) { // 如果速度差够大或距离非常近
|
|
|
- const isAI = targetTornado.ai;
|
|
|
- if (this.currentLv > targetTornado.currentLv && !isAI) {
|
|
|
- console.log(`AI 击杀玩家!!!`);
|
|
|
- GameMgr.inst.isWin = false;
|
|
|
- GameMgr.inst.setGameStatus(GameStatus.Revive);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ // const otherCollider = event.otherCollider;
|
|
|
+ // if (event.otherCollider.getGroup() === 1 << 3) {
|
|
|
+ // const targetTornado = otherCollider.node.parent.getComponent(TornadoComponent);
|
|
|
+ // if (!targetTornado) return;
|
|
|
+
|
|
|
+ // if (event.selfCollider.node.name == 'RigibodyStorm') {
|
|
|
+ // if (event.otherCollider.node.name == 'RigibodyStorm') {
|
|
|
+ // const distance = Vec3.distance(event.selfCollider.node.worldPosition, otherCollider.node.worldPosition);
|
|
|
+
|
|
|
+ // // 增加碰撞检测的容差范围
|
|
|
+ // const collisionThreshold = 3; // 增加检测范围
|
|
|
+ // if (distance <= collisionThreshold) {
|
|
|
+ // // 添加额外的速度检查,确保不会因为速度太快而错过碰撞
|
|
|
+ // const relativeSpeed = Math.abs(this.speed - targetTornado.speed);
|
|
|
+ // const minSpeedThreshold = 5; // 最小速度阈值
|
|
|
+
|
|
|
+ // if (relativeSpeed >= minSpeedThreshold || distance <= 1.5) { // 如果速度差够大或距离非常近
|
|
|
+ // const isAI = targetTornado.ai;
|
|
|
+ // if (this.currentLv > targetTornado.currentLv && !isAI) {
|
|
|
+ // console.log(`AI 击杀玩家!!!`);
|
|
|
+ // GameMgr.inst.isWin = false;
|
|
|
+ // GameMgr.inst.setGameStatus(GameStatus.Revive);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
}
|
|
|
|
|
|
protected addExpByKill() {
|