public void StopSpawnAndDestroyEnemies() { Debug.Log("Stop spawn enemies"); spawnTimer.Stop(100); for (int i = transform.childCount - 1; i >= 0; i--) { GameObject child = transform.GetChild(i).gameObject; if (child.CompareTag("Ship")) { Destroy(child); } } }
void ShowEnding(string text, Action onComplete) { if (!isShowingEndingUI) { roundTimer.Stop(17); endingText.text = text; playerShip.allowInput = false; RezTween.To(endingOverlay, 0.5f, "alpha:1").OnComplete = () => { playerShip.transform.position = Vector2.zero; enemyManager.StopSpawnAndDestroyEnemies(); BulletManager.Instance.ClearBullets(); UICanvas.SetActive(false); RezTween.To(endingOverlay, 0.5f, "alpha:0", RezTweenOptions.Delay(2f)).OnStart = onComplete; }; isShowingEndingUI = true; } }
private void OnDestroy() { timer?.Stop(10); }