From 3e20031e11cb84f5e64a79a01261c779886028f2 Mon Sep 17 00:00:00 2001 From: Andrew Lalis Date: Sat, 10 Jul 2021 12:58:25 +0200 Subject: [PATCH] Added killstreak tracker. --- core/src/main/java/nl/andrewlalis/aos_core/geom/Vec2.java | 3 +++ .../main/java/nl/andrewlalis/aos_core/model/Player.java | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/core/src/main/java/nl/andrewlalis/aos_core/geom/Vec2.java b/core/src/main/java/nl/andrewlalis/aos_core/geom/Vec2.java index 9d4d62f..64f0f9a 100644 --- a/core/src/main/java/nl/andrewlalis/aos_core/geom/Vec2.java +++ b/core/src/main/java/nl/andrewlalis/aos_core/geom/Vec2.java @@ -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); diff --git a/core/src/main/java/nl/andrewlalis/aos_core/model/Player.java b/core/src/main/java/nl/andrewlalis/aos_core/model/Player.java index 3a1f9e7..3d73703 100644 --- a/core/src/main/java/nl/andrewlalis/aos_core/model/Player.java +++ b/core/src/main/java/nl/andrewlalis/aos_core/model/Player.java @@ -27,6 +27,7 @@ public class Player extends PhysicsObject implements Comparable { 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 { 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() {