add player to verify condition

This commit is contained in:
XtraCube committed 2025-02-27 20:40:57 -05:00
1 parent 3d91c8de25
commit e3cf884975
3 files changed
+10 -3

No files matched your search

@@ -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!";
+2 -1
View File
@@ -18,8 +18,9 @@ public abstract class CustomGameOver
/// <summary>
/// Verifies if the condition for this CustomGameOver is met.
/// </summary>
/// <param name="playerControl">The PlayerControl that requested the Game Over.</param>
/// <returns>True if the condition is met, otherwise false.</returns>
public virtual bool VerifyCondition()
public virtual bool VerifyCondition(PlayerControl playerControl)
{
return true;
}
+1 -1
View File
@@ -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<MiraApiPlugin>.Info($"Game over condition not met for {gameOver.GetType().Name}");
return;