diff --git a/MiraAPI.Example/GameOver/NeutralKillerGameOver.cs b/MiraAPI.Example/GameOver/NeutralKillerGameOver.cs index 8d48a64..f513e8d 100644 --- a/MiraAPI.Example/GameOver/NeutralKillerGameOver.cs +++ b/MiraAPI.Example/GameOver/NeutralKillerGameOver.cs @@ -1,4 +1,5 @@ -using MiraAPI.GameEnd; +using MiraAPI.Example.Roles; +using MiraAPI.GameEnd; using MiraAPI.Utilities; using UnityEngine; @@ -6,6 +7,11 @@ namespace MiraAPI.Example.GameOver; public class NeutralKillerGameOver : CustomGameOver { + public override bool VerifyCondition(PlayerControl playerControl) + { + return playerControl.Data.Role is NeutralKillerRole; + } + public override void AfterEndGameSetup(EndGameManager endGameManager) { endGameManager.WinText.text = "Outcast Killer Wins!"; diff --git a/MiraAPI/GameEnd/CustomGameOver.cs b/MiraAPI/GameEnd/CustomGameOver.cs index 7f3d43a..bfb048f 100644 --- a/MiraAPI/GameEnd/CustomGameOver.cs +++ b/MiraAPI/GameEnd/CustomGameOver.cs @@ -18,8 +18,9 @@ public abstract class CustomGameOver /// /// Verifies if the condition for this CustomGameOver is met. /// + /// The PlayerControl that requested the Game Over. /// True if the condition is met, otherwise false. - public virtual bool VerifyCondition() + public virtual bool VerifyCondition(PlayerControl playerControl) { return true; } diff --git a/MiraAPI/Networking/CustomGameOverRpc.cs b/MiraAPI/Networking/CustomGameOverRpc.cs index 61d1f63..c269483 100644 --- a/MiraAPI/Networking/CustomGameOverRpc.cs +++ b/MiraAPI/Networking/CustomGameOverRpc.cs @@ -48,7 +48,7 @@ public class CustomGameOverRpc(MiraApiPlugin plugin, uint id) : PlayerCustomRpc< { if (GameOverManager.TryGetGameOver(data.Reason, out var gameOver)) { - if (!gameOver!.VerifyCondition()) + if (!gameOver!.VerifyCondition(innerNetObject)) { Logger.Info($"Game over condition not met for {gameOver.GetType().Name}"); return;