do not spawn where powerup is, nicer icon

This commit is contained in:
Vinzenz Schroeter 2024-04-17 19:46:14 +02:00
parent a2d46bda92
commit f167722034
2 changed files with 6 additions and 3 deletions

View file

@ -13,6 +13,11 @@ internal sealed class MapEntityManager(
public IEnumerable<Tank> Tanks => _tanks; public IEnumerable<Tank> Tanks => _tanks;
public IEnumerable<PowerUp> PowerUps => _powerUps; public IEnumerable<PowerUp> PowerUps => _powerUps;
public IEnumerable<IMapEntity> AllEntities => Bullets
.Cast<IMapEntity>()
.Concat(Tanks)
.Concat(PowerUps);
public void SpawnBullet(Player tankOwner, FloatPosition position, double rotation, bool isExplosive) public void SpawnBullet(Player tankOwner, FloatPosition position, double rotation, bool isExplosive)
=> _bullets.Add(new Bullet(tankOwner, position, rotation, isExplosive)); => _bullets.Add(new Bullet(tankOwner, position, rotation, isExplosive));
@ -50,9 +55,7 @@ internal sealed class MapEntityManager(
var tilePixelCenter = tile.ToPixelPosition().GetPixelRelative(4, 4).ToFloatPosition(); var tilePixelCenter = tile.ToPixelPosition().GetPixelRelative(4, 4).ToFloatPosition();
var minDistance = Bullets var minDistance = AllEntities
.Cast<IMapEntity>()
.Concat(Tanks)
.Select(entity => entity.Position.Distance(tilePixelCenter)) .Select(entity => entity.Position.Distance(tilePixelCenter))
.Aggregate(double.MaxValue, Math.Min); .Aggregate(double.MaxValue, Math.Min);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 B

After

Width:  |  Height:  |  Size: 112 B