public void AssignPoints() { BaseGameMode activeGameMode = BaseGameMode.GetActiveGameMode(true); if (activeGameMode == null || !activeGameMode.IsMatchActive()) { return; } if (activeGameMode.IsTeamGame()) { if (captureTeam != -1 && captureFraction == 1f) { activeGameMode.ModifyTeamScore(captureTeam, scorePerSecond); } } else if (capturedPlayer.IsValid(true)) { activeGameMode.ModifyPlayerGameScore(capturedPlayer.Get(true).GetComponent <BasePlayer>(), "score", scorePerSecond); } }
public void UpdateCaptureAmount() { if (base.isClient) { return; } float num = captureFraction; BaseGameMode activeGameMode = BaseGameMode.GetActiveGameMode(true); if (activeGameMode == null) { return; } if (captureTrigger.entityContents == null) { SetFlag(Flags.Busy, false, false, false); } else { if (!activeGameMode.IsMatchActive()) { return; } if (activeGameMode.IsTeamGame()) { int[] array = new int[activeGameMode.GetNumTeams()]; foreach (BaseEntity entityContent in captureTrigger.entityContents) { if (!(entityContent == null) && !entityContent.isClient) { BasePlayer component = entityContent.GetComponent <BasePlayer>(); if (!(component == null) && component.IsAlive() && !component.IsNpc && component.gamemodeteam != -1) { array[component.gamemodeteam]++; } } } int num2 = 0; for (int i = 0; i < array.Length; i++) { if (array[i] > 0) { num2++; } } if (num2 < 2) { int num3 = -1; int num4 = 0; for (int j = 0; j < array.Length; j++) { if (array[j] > num4) { num4 = array[j]; num3 = j; } } if (captureTeam == -1 && captureFraction == 0f) { capturingTeam = num3; } if (captureFraction > 0f && num3 != captureTeam && num3 != capturingTeam) { captureFraction = Mathf.Clamp01(captureFraction - Time.deltaTime / timeToCapture); if (captureFraction == 0f) { captureTeam = -1; } } else if (captureTeam == -1 && captureFraction < 1f && capturingTeam == num3) { DoProgressEffect(); captureFraction = Mathf.Clamp01(captureFraction + Time.deltaTime / timeToCapture); if (captureFraction == 1f) { DoCaptureEffect(); captureTeam = num3; } } } SetFlag(Flags.Busy, num2 > 1); } else { if (!capturingPlayer.IsValid(true) && !capturedPlayer.IsValid(true)) { captureFraction = 0f; } if (captureTrigger.entityContents.Count == 0) { capturingPlayer.Set(null); } if (captureTrigger.entityContents.Count == 1) { foreach (BaseEntity entityContent2 in captureTrigger.entityContents) { BasePlayer component2 = entityContent2.GetComponent <BasePlayer>(); if (component2 == null) { continue; } if (!capturedPlayer.IsValid(true) && captureFraction == 0f) { capturingPlayer.Set(component2); } if (captureFraction > 0f && component2 != capturedPlayer.Get(true) && component2 != capturingPlayer.Get(true)) { captureFraction = Mathf.Clamp01(captureFraction - Time.deltaTime / timeToCapture); if (captureFraction == 0f) { capturedPlayer.Set(null); } } else if (!capturedPlayer.Get(true) && captureFraction < 1f && capturingPlayer.Get(true) == component2) { DoProgressEffect(); captureFraction = Mathf.Clamp01(captureFraction + Time.deltaTime / timeToCapture); if (captureFraction == 1f) { DoCaptureEffect(); capturedPlayer.Set(component2); } } break; } } SetFlag(Flags.Busy, captureTrigger.entityContents.Count > 1); } if (num != captureFraction) { SendNetworkUpdate(); } } }