From f16772203433fb1d17c33f316c079084b87f89c0 Mon Sep 17 00:00:00 2001 From: Vinzenz Schroeter Date: Wed, 17 Apr 2024 19:46:14 +0200 Subject: [PATCH] do not spawn where powerup is, nicer icon --- TanksServer/GameLogic/MapEntityManager.cs | 9 ++++++--- TanksServer/assets/powerup_explosive.png | Bin 130 -> 112 bytes 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/TanksServer/GameLogic/MapEntityManager.cs b/TanksServer/GameLogic/MapEntityManager.cs index 6796a23..bfb976a 100644 --- a/TanksServer/GameLogic/MapEntityManager.cs +++ b/TanksServer/GameLogic/MapEntityManager.cs @@ -13,6 +13,11 @@ internal sealed class MapEntityManager( public IEnumerable Tanks => _tanks; public IEnumerable PowerUps => _powerUps; + public IEnumerable AllEntities => Bullets + .Cast() + .Concat(Tanks) + .Concat(PowerUps); + public void SpawnBullet(Player tankOwner, FloatPosition position, double rotation, bool 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 minDistance = Bullets - .Cast() - .Concat(Tanks) + var minDistance = AllEntities .Select(entity => entity.Position.Distance(tilePixelCenter)) .Aggregate(double.MaxValue, Math.Min); diff --git a/TanksServer/assets/powerup_explosive.png b/TanksServer/assets/powerup_explosive.png index 257ad67323f64be3752c1d5a2dad7db72802ead9..f1854d2afabcb3d6fab333b0b5788f8750fbebb8 100644 GIT binary patch delta 66 zcmZo-ESO+oqweYA7$Pw>IYEK-Pdn3`Njy9}{}W$r@KTz|5PrmE(qD_U3a2LSU|_hn W$Mo#S(^-odfWXt$&t;ucLK6T-a2f>w delta 84 zcmV-a0IUCSf&q{;PB}?LK~xx(b&o*~03Zy)VDbN7#)Bc56MLkCWW+(pkd~5$ApoF~ q>{-p0o8~%5tTg*9%-NpVeBa#Nu@4fgI7yEH0000