|
@@ -221,9 +221,11 @@ export class PlayerMgr {
|
|
|
//销毁除第一个节点外的其他AI节点
|
|
|
public destroyOtherAI() {
|
|
|
const playersUI = StormSunderGlobalInstance.instance.players!;
|
|
|
- for (let i = 1; i < playersUI.removeChild.length; i++) {
|
|
|
- playersUI.removeChild[i].destroy();
|
|
|
- }
|
|
|
+ playersUI.children.forEach((child, index) => {
|
|
|
+ if (child.getComponent(TornadoAIComponent)) {
|
|
|
+ child.getComponent(TornadoAIComponent)!.node.destroy();
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
//随机拼接名称
|
|
@@ -252,14 +254,6 @@ export class PlayerMgr {
|
|
|
reset() {
|
|
|
this.destroyOtherAI();
|
|
|
this.aiIndex = 0;
|
|
|
-
|
|
|
- //去除掉除第一个节点外的其他AI节点
|
|
|
- const playersUI = StormSunderGlobalInstance.instance.players!;
|
|
|
- playersUI.children.forEach((child, index) => {
|
|
|
- if (child.getComponent(TornadoAIComponent)) {
|
|
|
- child.getComponent(TornadoAIComponent)!.node.destroy();
|
|
|
- }
|
|
|
- })
|
|
|
}
|
|
|
|
|
|
}
|