public void RemoveObject(AGameObject gameObject) { if (_gameObjects.Contains(gameObject)) { _gameObjects.Remove(gameObject); } }
public void AddObject(AGameObject newGameObject) { if (!IsCorrectLocation(newGameObject.Location)) { throw new ArgumentException(); } _gameObjects.Add(newGameObject); if (!(newGameObject is AFish fish)) { return; } fish.OnDie += RemoveObject; }