public void DestroyEnemy(EnemyController controller, EnemyView view) { var model = _controllerModelPairs[controller]; if (model.Description.CreateNewEnemyAfterDie) { EnemyController[] controllers; EnemyModel[] models; EnemyView[] views; int numPrefab = Convert.ToInt32(model.Description.TypeEnemy); int countChilds = 2; _enemySpawnManager.SpawnChildEnemy(model, _enemyPrefabs[numPrefab], countChilds, out controllers, out models, out views); if (controllers != null && models != null && views != null) { for (int i = 0; i < countChilds; i++) { controllers[i].Destroy += DestroyEnemy; _controllerModelPairs.Add(controllers[i], models[i]); _viewModelPairs.Add(views[i], models[i]); _enemyModels.Add(models[i]); } } } Destroy?.Invoke(model); _enemyModels.Remove(model); _controllerModelPairs.Remove(controller); _viewModelPairs.Remove(view); controller.Destroy -= DestroyEnemy; controller = null; }
private void DestroyPlayer() { Disable(); Destroy?.Invoke(_playerModel.CurrentScore); _playerView.DestroyPlayer(); _playerViewUI.DestroyPlayer(); _playerView = null; _playerViewUI = null; _playerModel = null; }
//销毁 public void Release() { using (var enumerator = m_inactitveGameObjects.GetEnumerator()) { while (enumerator.MoveNext()) { if (pDestroy != null) { pDestroy.Invoke(enumerator.Current); } } } for (int i = 0; i < m_actitveGameObjects.Count; i++) { if (pDestroy != null) { pDestroy.Invoke(m_actitveGameObjects[i]); } } m_inactitveGameObjects.Clear(); m_actitveGameObjects.Clear(); }
public void DestroyAllEnemies() { _viewModelPairs.Clear(); var controllerModelArray = _controllerModelPairs.Keys.ToArray(); for (int i = controllerModelArray.Length - 1; i >= 0; i--) { var model = _controllerModelPairs[controllerModelArray[i]]; Destroy?.Invoke(model); _enemyModels.Remove(model); _controllerModelPairs.Remove(controllerModelArray[i]); controllerModelArray[i].Destroy -= DestroyEnemy; controllerModelArray[i] = null; } }
private void OnDestroy() { Destroy?.Invoke(); if (_enemy != null) { _enemy.Kill?.Invoke(); } var units = transform.parent.GetComponentsInChildren <Unit>(); if (_enemy != null && units.Length == 1) { if (_enemy.GetComponent <WorkWithUI>() != null) { _enemy.GetComponent <WorkWithUI>().StopGame(); } } }
protected virtual void OnDestroy() { Destroy?.Invoke(this, new EventArgs()); }
private void OnDestroy() { Destroy?.Invoke(); }
protected override void OnDestroy() { Destroy?.Invoke(this, new EventArgs()); base.OnDestroy(); }
public virtual void OnDestroy() { Destroy?.Invoke(this, new DestroyEventArgs(this)); }
protected virtual void OnDestroy() { Destroy?.Invoke(this, EventArgs.Empty); }
private void OnDestroy() { InvokeCommon <OnDestroyMethodAttribute>(); Destroy?.Invoke(); s_instance = null; }
public void DestroyPlayer(float score) { Destroy?.Invoke(score); _playerController.Destroy -= DestroyPlayer; _playerController = null; }
private void OnPlaneHit(object sender, EventArgs ea) { Destroy?.Invoke(this, EventArgs.Empty); }
public void OnDestroy() { Destroy?.Invoke(this, this); }
public void Hit() { Destroy?.Invoke(this, EventArgs.Empty); }
internal void PerformDestroy() { OnDestroy(); Destroy?.Invoke(this); }