|
@@ -5,8 +5,6 @@ import { GameUtil } from '../GameUtil';
|
|
|
import { PropMgr } from '../Manager/PropMgr';
|
|
|
import { GameMgr, GameStatus } from '../Manager/GameMgr';
|
|
|
import { PlayerMgr } from '../Manager/PlayerMgr';
|
|
|
-import { tgxUIMgr } from 'db://assets/core_tgx/tgx';
|
|
|
-import { UI_BattleRevive } from 'db://assets/scripts/UIDef';
|
|
|
import { EventDispatcher } from 'db://assets/core_tgx/easy_ui_framework/EventDispatcher';
|
|
|
import { GameEvent } from '../Enum/GameEvent';
|
|
|
|
|
@@ -40,8 +38,6 @@ export class TornadoAIComponent extends TornadoComponent {
|
|
|
|
|
|
this.initAIPlayer();
|
|
|
this.onPlayerInfoHandler();
|
|
|
- // this.decideAction(); // 进入行为循环
|
|
|
-
|
|
|
this.tigger.on('onTriggerEnter', this.onTriggerEnter, this);
|
|
|
this.radiusTigger.on('onTriggerEnter', this.onRadiusTriggerEnter, this);
|
|
|
this.registerEvent();
|
|
@@ -49,6 +45,7 @@ export class TornadoAIComponent extends TornadoComponent {
|
|
|
|
|
|
protected registerEvent(): void {
|
|
|
EventDispatcher.instance.on(GameEvent.EVENT_GAME_START, this.decideAction, this);
|
|
|
+ EventDispatcher.instance.on(GameEvent.EVENT_GAME_START_EFFECT, this.decideAction, this);
|
|
|
}
|
|
|
|
|
|
private initAIPlayer() {
|
|
@@ -262,4 +259,10 @@ export class TornadoAIComponent extends TornadoComponent {
|
|
|
Tween.stopAllByTarget(this.node);
|
|
|
}
|
|
|
|
|
|
+ protected onDestroy(): void {
|
|
|
+ this.cancelAction();
|
|
|
+ EventDispatcher.instance.off(GameEvent.EVENT_GAME_START, this.decideAction, this);
|
|
|
+ EventDispatcher.instance.off(GameEvent.EVENT_GAME_START_EFFECT, this.decideAction, this);
|
|
|
+ }
|
|
|
+
|
|
|
}
|