|
@@ -40,6 +40,7 @@ export class TornadoAIComponent extends TornadoComponent {
|
|
|
this.onPlayerInfoHandler();
|
|
|
this.decideAction(); // 进入行为循环
|
|
|
|
|
|
+ this.tigger.on('onTriggerEnter', this.onTriggerEnter, this);
|
|
|
this.radiusTigger.on('onTriggerEnter', this.onRadiusTriggerEnter, this);
|
|
|
}
|
|
|
|
|
@@ -60,7 +61,8 @@ export class TornadoAIComponent extends TornadoComponent {
|
|
|
this.chasePlayerProbability = pursuit_2;
|
|
|
|
|
|
//test
|
|
|
- this.chasePlayerProbability = 100;
|
|
|
+ // this.chaseAIProbability = 100;
|
|
|
+ // this.chasePlayerProbability = 100;
|
|
|
this.moveProbability = move_judge;
|
|
|
|
|
|
this.nextExp = this.attributeBonusMgr.getExpNeed(this.currentLv + 1);
|
|
@@ -117,6 +119,7 @@ export class TornadoAIComponent extends TornadoComponent {
|
|
|
}
|
|
|
|
|
|
protected onTriggerEnter(event: ITriggerEvent): void {
|
|
|
+ const otherCollider = event.otherCollider;
|
|
|
if (event.otherCollider.getGroup() === 1 << 2) {
|
|
|
this.unscheduleAllCallbacks();
|
|
|
this.isChasing = false;
|
|
@@ -127,23 +130,22 @@ export class TornadoAIComponent extends TornadoComponent {
|
|
|
this.setPositionByObstacle(event, () => {
|
|
|
this.decideAction();
|
|
|
});
|
|
|
+ } else if (event.otherCollider.getGroup() === 1 << 3) {
|
|
|
+ if (otherCollider.getGroup() == 1 << 3) {
|
|
|
+ const targetTornado = otherCollider.node.parent.getComponent(TornadoComponent);
|
|
|
+ if (!targetTornado) return;
|
|
|
+
|
|
|
+ const isPlayer = targetTornado instanceof TornadoComponent;
|
|
|
+ if (this.currentLv > targetTornado.currentLv && isPlayer) {
|
|
|
+ GameMgr.inst.isWin = false;
|
|
|
+ GameMgr.inst.setGameStatus(GameStatus.Revive);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
protected onTriggerStay(event: ITriggerEvent): void {
|
|
|
super.onTriggerStay(event);
|
|
|
- const otherCollider = event.otherCollider;
|
|
|
-
|
|
|
- if (otherCollider.getGroup() == 1 << 3) {
|
|
|
- const targetTornado = otherCollider.node.parent.getComponent(TornadoComponent);
|
|
|
- if (!targetTornado) return;
|
|
|
-
|
|
|
- const isPlayer = targetTornado instanceof TornadoComponent;
|
|
|
- if (this.currentLv > targetTornado.currentLv && isPlayer) {
|
|
|
- GameMgr.inst.isWin = false;
|
|
|
- GameMgr.inst.setGameStatus(GameStatus.Revive);
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
protected addExpByKill() {
|
|
@@ -171,7 +173,7 @@ export class TornadoAIComponent extends TornadoComponent {
|
|
|
if (Math.random() * 100 < this.chaseAIProbability) {
|
|
|
if (isTargetAI) {
|
|
|
// 目标是 AI,直接追击
|
|
|
- this.chaseTarget(targetTornado.node);
|
|
|
+ // this.chaseTarget(targetTornado.node);
|
|
|
} else {
|
|
|
// 目标是玩家,进一步判断是否追击
|
|
|
if (Math.random() * 100 < this.chasePlayerProbability) {
|