public void UpdatePlayerCollision(PlayerCharacter playerCharacter) { foreach (Bullet bullet in _enemyBullets) { if (bullet.GetBoundingBox().IntersectsWith(playerCharacter.GetBoundingBox())) { bullet.Dead = true; playerCharacter.OnCollision(bullet); } } }
private void UpdateCollisions() { _bulletManager.UpdatePlayerCollision(_playerCharacter); foreach (Enemy enemy in _enemyManager.EnemyList) { if (enemy.GetBoundingBox().IntersectsWith(_playerCharacter.GetBoundingBox())) { enemy.OnCollision(_playerCharacter); _playerCharacter.OnCollision(enemy); } _bulletManager.UpdateEnemyCollisions(enemy); } }