mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-20 01:46:15 +00:00
add player to verify condition
This commit is contained in:
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!";
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user