implement smart bullet

This commit is contained in:
Vinzenz Schroeter 2024-04-29 21:52:50 +02:00
parent 21f7d1d5f4
commit 0e01ff0fb9
9 changed files with 54 additions and 21 deletions

View file

@ -4,7 +4,7 @@ internal sealed class Bullet : IMapEntity
{
public required Player Owner { get; init; }
public required double Rotation { get; init; }
public required double Rotation { get; set; }
public required FloatPosition Position { get; set; }
@ -17,4 +17,6 @@ internal sealed class Bullet : IMapEntity
internal required DateTime OwnerCollisionAfter { get; init; }
public required double Speed { get; init; }
public required bool IsSmart { get; init; }
}

View file

@ -21,16 +21,13 @@ internal readonly record struct Magazine(MagazineType Type, byte UsedBullets, by
var sb = new StringBuilder();
if (Type.HasFlag(MagazineType.Fast))
sb.Append('»');
sb.Append("» ");
if (Type.HasFlag(MagazineType.Explosive))
sb.Append('*');
sb.Append("* ");
if (Type.HasFlag(MagazineType.Smart))
sb.Append('@');
sb.Append("@ ");
if (Type.HasFlag(MagazineType.Mine))
sb.Append('\u263c');
if (sb.Length > 0)
sb.Append(' ');
sb.Append("\u263c ");
sb.Append("[ ");
for (var i = 0; i < UsedBullets; i++)

View file

@ -22,7 +22,6 @@ internal static class PositionHelpers
public static FloatPosition ToFloatPosition(this PixelPosition position) => new(position.X, position.Y);
public static double Distance(this FloatPosition p1, FloatPosition p2)
=> Math.Sqrt(
Math.Pow(p1.X - p2.X, 2) +