From 4c415db023704990e1eedf409c60e5173ffca311 Mon Sep 17 00:00:00 2001 From: Steven Leal Date: Thu, 30 Nov 2017 14:11:04 -0600 Subject: [PATCH] guards can't keep giving spies points after someone wins --- Project Undercover/Assets/Scripts/MissionTracker.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Project Undercover/Assets/Scripts/MissionTracker.cs b/Project Undercover/Assets/Scripts/MissionTracker.cs index 146dae9..237cf8a 100755 --- a/Project Undercover/Assets/Scripts/MissionTracker.cs +++ b/Project Undercover/Assets/Scripts/MissionTracker.cs @@ -246,6 +246,9 @@ public class MissionTracker : Photon.PunBehaviour [PunRPC] void CompleteMissionRPC(string interactionName) { + if (mCompletedMissions + mGuardIncorrectGuesses >= mMissionLog.Count) + return; + Mission m = mMissionLog[interactionName]; m.Completed = true; mCompletedMissions++; @@ -260,6 +263,9 @@ public class MissionTracker : Photon.PunBehaviour [PunRPC] void CaughtAgentRPC(int spyId) { + if (mGuardPoints >= mMissionLog.Count) + return; + mGuardPoints++; ScorePanelController.Singleton.UpdateGuardScore((float) mGuardPoints / MAX_GUARD_POINTS); @@ -273,6 +279,9 @@ public class MissionTracker : Photon.PunBehaviour [PunRPC] void CaughtIncorrectRPC() { + if (mCompletedMissions + mGuardIncorrectGuesses >= MAX_GUARD_POINTS) + return; + mGuardIncorrectGuesses++; float score = mCompletedMissions + mGuardIncorrectGuesses; ScorePanelController.Singleton.UpdateSpyScore(score / mMissionLog.Count);