add distance moved score
This commit is contained in:
parent
259d63d683
commit
4e605d556c
5 changed files with 15 additions and 0 deletions
|
@ -54,6 +54,7 @@ internal sealed class MoveTanks(
|
|||
if (HitsTank(tank, newPosition))
|
||||
return false;
|
||||
|
||||
tank.Owner.Scores.DistanceMoved += newPosition.Distance(tank.Position);
|
||||
tank.Position = newPosition;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace TanksServer.Models;
|
||||
|
||||
internal sealed record class Scores
|
||||
|
@ -24,10 +26,15 @@ internal sealed record class Scores
|
|||
|
||||
public int PowerUpsCollected { get; set; }
|
||||
|
||||
[JsonIgnore] public double DistanceMoved { get; set; }
|
||||
|
||||
public int PixelsMoved => (int)DistanceMoved;
|
||||
|
||||
public int OverallScore => Math.Max(0,
|
||||
10000 * Kills
|
||||
- 1000 * Deaths
|
||||
+ 100 * PowerUpsCollected
|
||||
+ 10 * (ShotsFired + WallsDestroyed)
|
||||
+ PixelsMoved
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue