//被击毁与重生 public override void Die() { UIcontroller uic = GameObject.Find("UIcontroller").GetComponent <UIcontroller>(); for (int i = 1; i <= uic.shop.soilders.Length; i++) { if (uic.shop.soilders[i - 1] == gameObject) { uic.whichIsChanged = i; } } uic.Refresh(true); Destroy(gameObject); uic.activeSoilders--; globalChangeController.GlobalChange -= SelectChange; foreach (var type in teamStructureTypes) { for (int i = 1; i <= globalChangeController.teams.Length; i++) { if (type == globalChangeController.teams[i - 1].name) { globalChangeController.teams[i - 1].Num--; } } } }