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.Random;
import java.util.concurrent.ThreadLocalRandom; 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 record Vec2(float x, float y) implements Serializable {
public static final Vec2 ZERO = new Vec2(0, 0); public static final Vec2 ZERO = new Vec2(0, 0);
public static final Vec2 UP = new Vec2(0, -1); 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 deathCount;
private transient int shotCount; private transient int shotCount;
private transient int resupplyCount; private transient int resupplyCount;
private transient int killStreak;
public Player(int id, String name, Team team, GunType gunType, float maxHealth) { public Player(int id, String name, Team team, GunType gunType, float maxHealth) {
this.id = id; this.id = id;
@ -168,12 +169,18 @@ public class Player extends PhysicsObject implements Comparable<Player> {
return resupplyCount; return resupplyCount;
} }
public int getKillStreak() {
return killStreak;
}
public void incrementDeathCount() { public void incrementDeathCount() {
this.deathCount++; this.deathCount++;
this.killStreak = 0;
} }
public void incrementKillCount() { public void incrementKillCount() {
this.killCount++; this.killCount++;
this.killStreak++;
} }
public void resetStats() { public void resetStats() {