IEnumerator CharacterDestroy() { for (int i = this.m_InvaderList.Count - 1; i >= 0; i--) { GameObject invader = this.m_InvaderList[i]; if (invader != null) { CharacterHPBehavior hpBehavior = invader.GetComponent <CharacterHPBehavior>(); BattleMapData.Instance.RefreshInformationWithDestroyActor(invader, PositionConvertor.GetActorTileIndexFromWorldPosition(invader.transform.position)); hpBehavior.SetDead(); yield return(new WaitForSeconds(0.2f)); } } this.m_InvaderList.Clear(); }
public void DestroyAllInvaders() { if (BattleDirector.Instance == null) { foreach (GameObject invader in this.m_InvaderList) { CharacterHPBehavior hpBehavior = invader.GetComponent <CharacterHPBehavior>(); BattleMapData.Instance.RefreshInformationWithDestroyActor(invader, PositionConvertor.GetActorTileIndexFromWorldPosition(invader.transform.position)); hpBehavior.SetDead(); } this.m_InvaderList.Clear(); } else { foreach (GameObject invader in this.m_InvaderList) { invader.GetComponent <NewAI>().enabled = false; } this.StartCoroutine("CharacterDestroy"); } }