private void _gameLoopTimer_Tick(object sender, EventArgs e) { _zoo.Update(); for (int i = _animals.Count - 1; i >= 0; i--) { if (!_animals[i].IsAlive) { _animals.RemoveAt(i); } } _animalsCountToolTip.SetToolTip(_createAnimalsBouton, "Animals count : " + _animals.Count.ToString()); TimerTick?.Invoke(this, _animals); }
private void _gameLoopTimer_Tick(object sender, EventArgs e) { _zoo.Update(); if (_zoo.CollectFindMethod) { for (int i = _animals.Count - 1; i >= 0; i--) { bool isAlive = _zoo.Find(_animals[i]); if (!isAlive) { _animals.RemoveAt(i); } } } _animalsCountToolTip.SetToolTip(_createAnimalsBouton, "Animals count : " + _animals.Count.ToString()); TimerTick?.Invoke(this, _animals); }