Added killstreak tracker.

This commit is contained in:
Andrew Lalis 2021-07-10 12:58:25 +02:00
parent 23d4cd6c8f
commit 3e20031e11
2 changed files with 10 additions and 0 deletions

View File

@ -6,6 +6,9 @@ import java.io.Serializable;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
/**
* A two-dimensional, floating-point vector consisting of an x- and y-component.
*/
public record Vec2(float x, float y) implements Serializable {
public static final Vec2 ZERO = new Vec2(0, 0);
public static final Vec2 UP = new Vec2(0, -1);

View File

@ -27,6 +27,7 @@ public class Player extends PhysicsObject implements Comparable<Player> {
private transient int deathCount;
private transient int shotCount;
private transient int resupplyCount;
private transient int killStreak;
public Player(int id, String name, Team team, GunType gunType, float maxHealth) {
this.id = id;
@ -168,12 +169,18 @@ public class Player extends PhysicsObject implements Comparable<Player> {
return resupplyCount;
}
public int getKillStreak() {
return killStreak;
}
public void incrementDeathCount() {
this.deathCount++;
this.killStreak = 0;
}
public void incrementKillCount() {
this.killCount++;
this.killStreak++;
}
public void resetStats() {