add walls destroyed stat

This commit is contained in:
Vinzenz Schroeter 2024-04-19 13:34:56 +02:00
parent 0aac6f780b
commit 9cf4304845
4 changed files with 12 additions and 0 deletions

View file

@ -77,7 +77,11 @@ internal sealed class CollideBullets(
{
var offsetPixel = new PixelPosition(x, y);
if (options.Value.DestructibleWalls)
{
map.Current.DestroyWallAt(offsetPixel);
owner.Scores.WallsDestroyed++;
}
TryHitTankAt(offsetPixel.ToFloatPosition(), owner);
}
}

View file

@ -17,4 +17,6 @@ internal sealed record class Scores(int Kills = 0, int Deaths = 0)
return Kills / (double)Deaths;
}
}
public int WallsDestroyed { get; set; }
}

View file

@ -42,6 +42,11 @@ export default function Scoreboard({}: {}) {
field: 'ratio',
visualize: p => p.scores.ratio.toString(),
sorter: (a, b) => numberSorter(a.scores.ratio, b.scores.ratio)
},
{
field: 'walls',
visualize: p => p.scores.wallsDestroyed.toString(),
sorter: (a, b) => numberSorter(a.scores.wallsDestroyed, b.scores.wallsDestroyed)
}
]}/>
}

View file

@ -14,6 +14,7 @@ export type Player = {
readonly scores: {
readonly kills: number;
readonly deaths: number;
readonly wallsDestroyed: number;
};
};