-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Prevent the player from returning to class selection after death (…
…#73) Do not allow the player to return to class selection after death. This prevents a bug where the team counter can be affected. For example, if Player A is from Team Alpha and returns to class selection to choose Team Alpha again, it would result in duplicate team members, which is incorrect.
- Loading branch information
1 parent
981fa58
commit c3acb80
Showing
3 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/Application/Players/Extensions/ClassSelectionExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
namespace CTF.Application.Players.Extensions; | ||
|
||
public static class ClassSelectionExtensions | ||
{ | ||
public static bool IsInClassSelection(this Player player) | ||
=> player.GetComponent<ClassSelectionComponent>().IsInClassSelection; | ||
|
||
public static bool IsNotInClassSelection(this Player player) | ||
=> !player.IsInClassSelection(); | ||
|
||
public static bool HasForcedClassSelectionAfterDeath(this Player player) | ||
=> !player.IsInClassSelection(); | ||
|
||
public static void SetInClassSelection(this Player player) | ||
=> player.GetComponent<ClassSelectionComponent>().IsInClassSelection = true; | ||
|
||
public static void RemoveFromClassSelection(this Player player) | ||
=> player.GetComponent<ClassSelectionComponent>().IsInClassSelection = false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters