Skip to content

Commit

Permalink
Actually broadcast the shot
Browse files Browse the repository at this point in the history
  • Loading branch information
DoubleF3lix committed Jul 31, 2024
1 parent 4f91a8d commit 76d4279
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 0 additions & 1 deletion GameData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ public void eliminatePlayer(string username) {
if (index < this.currentTurnIndex) {
this.currentTurnIndex--;
}
this.currentTurnIndex = this.currentTurnIndex % this.turnOrder.Count;
}
this.getPlayerByUsername(username).isSpectator = true;
}
Expand Down
4 changes: 3 additions & 1 deletion Server.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ public async Task packetReceived(Client sender, ClientPacket packet) {
case ShootPlayerPacket shootPlayerPacket:
// Make sure it's the players turn
if (sender.player == this.gameData.getCurrentPlayerForTurn()) {
// TODO subtract life, check for double damage, etc.
await broadcast(new PlayerShotPacket { target = shootPlayerPacket.target });
await this.nextTurn();
}
break;
Expand Down Expand Up @@ -188,7 +190,7 @@ public async Task nextTurn() {
await broadcast(new TurnStartedPacket { username = playerForTurn.username });

if (playerForTurn.inGame == false) {
// await broadcast(new PlayerShot { target = playerForTurn.username });
await broadcast(new PlayerShotPacket { target = playerForTurn.username });
await this.nextTurn();
}
}
Expand Down

0 comments on commit 76d4279

Please sign in to comment.