void ChangeCameraViews() { foreach (SecurityCam securityCam in SecurityCameraList) { bool onScreen = false; securityCam.Distance = Vector3.Distance(Player.transform.position, securityCam.SecurityCamObject.transform.position); // securityCam.SecurityCamObject.GetComponent<Camera>().targetTexture = null; Vector3 screenPoint = securityCam.SecurityCamObject.GetComponent <Camera>().WorldToViewportPoint(Player.transform.position); Vector3 rayDir = Player.transform.position - securityCam.SecurityCamObject.transform.position; RaycastHit info; Physics.Raycast(securityCam.SecurityCamObject.transform.position, rayDir, out info, 100); if (info.transform == Player.transform) { onScreen = screenPoint.z > 0 && screenPoint.x > 0 && screenPoint.x < 1 && screenPoint.y > 0 && screenPoint.y < 1; } securityCam.SecurityCamObject.SetActive(onScreen); List <SecurityCam> SortedSecurityCameraList = SecurityCameraList.OrderBy(o => o.Distance).ToList(); for (int cameraToActivate = 0; cameraToActivate < 4; cameraToActivate++) { SecurityCam currentCam = SortedSecurityCameraList[cameraToActivate]; currentCam.SecurityCamObject.GetComponent <Camera>().targetTexture = SecurityScreenArray[cameraToActivate]; currentCam.SecurityCamObject.SetActive(true); SecurityScreenTextArray[cameraToActivate].GetComponent <Text>().text = string.Format("CAM {0}", currentCam.Name.Substring(currentCam.Name.Length - 2, 2)); } } }
public void TurnOnOffCam(SecurityCam cam) { if (!cam.isServer) { cam.CmdTurnOnOff(!cam.isOn); //cam.RpcTurnOnOff(!cam.isOn); } else { cam.RpcTurnOnOff(!cam.isOn); } }
// Non-Patch public static IEnumerator SpecialAbilityInterfaceCheck2_Enumerator(StatusEffects __instance) { // Sniper Headshot indicators #region Vanilla __instance.startedSpecialAbilityInterfaceCheck = true; if (__instance.startedSpecialAbilityInterfaceCheck) { do { if (GC.loadComplete && __instance.agent.specialAbilityIndicator != null && !__instance.agent.disappearedArcade && __instance.agent.inventory.buffDisplay.specialAbilitySlot != null && !__instance.agent.ghost) { string specialAbility = __instance.agent.specialAbility; if (specialAbility == vSpecialAbility.Bite) { bool flag = false; if ((__instance.agent.health < __instance.agent.healthMax || __instance.agent.oma.superSpecialAbility || __instance.hasTrait("BiteFullHealth")) && __instance.agent.bitingAgent == null && __instance.CanShowSpecialAbilityIndicator()) { Agent agent = (Agent)__instance.FindSpecialAbilityObject(); if (agent != null) { __instance.agent.specialAbilityIndicator.ShowIndicator(agent, "Bite"); flag = true; } } if (!flag) { __instance.agent.specialAbilityIndicator.Revert(); } } else if (specialAbility == vSpecialAbility.ChloroformHankie) { bool targetAvailable = false; if (__instance.agent.inventory.equippedSpecialAbility.invItemCount == 0 && __instance.CanShowSpecialAbilityIndicator()) { Agent targetAgent = __instance.CanSpecialAttack(false); if (targetAgent != null) { __instance.agent.specialAbilityIndicator.ShowIndicator(targetAgent, "Chloroform"); targetAvailable = true; } __instance.agent.inventory.buffDisplay.specialAbilitySlot.MakeUsable(); } if (!targetAvailable) { __instance.agent.specialAbilityIndicator.Revert(); } } else if (specialAbility == vSpecialAbility.Handcuffs) { bool flag3 = false; if (__instance.agent.arrestingAgent == null && __instance.CanShowSpecialAbilityIndicator()) { Agent agent3 = (Agent)__instance.FindSpecialAbilityObject(); if (agent3 != null) { if (agent3.statusEffects.IsInnocent(__instance.agent) && !__instance.agent.oma.superSpecialAbility) { __instance.agent.specialAbilityIndicator.ShowIndicator(agent3, "Handcuffs", "Innocent"); } else { __instance.agent.specialAbilityIndicator.ShowIndicator(agent3, "Handcuffs", "Guilty"); } flag3 = true; } } if (!flag3) { __instance.agent.specialAbilityIndicator.Revert(); } } else if (specialAbility == vSpecialAbility.Enslave) { bool flag4 = false; if (__instance.agent.arrestingAgent == null && __instance.CanShowSpecialAbilityIndicator()) { Agent agent4 = (Agent)__instance.FindSpecialAbilityObject(); if (agent4 != null) { __instance.agent.specialAbilityIndicator.ShowIndicator(agent4, "Enslave"); flag4 = true; } } if (!flag4) { __instance.agent.specialAbilityIndicator.Revert(); } } else if (specialAbility == vSpecialAbility.Toss) { bool flag5 = false; if (__instance.agent.hoistingObject == null && __instance.CanShowSpecialAbilityIndicator()) { ObjectReal objectReal = (ObjectReal)__instance.FindSpecialAbilityObject(); if (objectReal != null) { flag5 = true; __instance.agent.specialAbilityIndicator.ShowIndicator(objectReal, "Toss"); } } if (!flag5) { __instance.agent.specialAbilityIndicator.Revert(); } } else if (specialAbility == vSpecialAbility.Cannibalize) { bool flag6 = false; if (__instance.agent.bitingAgent == null && __instance.CanShowSpecialAbilityIndicator()) { Agent agent5 = (Agent)__instance.FindSpecialAbilityObject(); if (agent5 != null && (__instance.agent.health < __instance.agent.healthMax || (agent5.agentName == __instance.agent.oma.bigQuestTarget1 && __instance.agent.oma.bigQuestObjectCount == 0))) { __instance.agent.specialAbilityIndicator.ShowIndicator(agent5, "Cannibalize"); flag6 = true; } } if (!flag6) { __instance.agent.specialAbilityIndicator.Revert(); } } else if (specialAbility == vSpecialAbility.Possess) { bool flag7 = false; if (!__instance.agent.possessing && __instance.CanShowSpecialAbilityIndicator()) { Agent agent6 = (Agent)__instance.FindSpecialAbilityObject(); if (agent6 != null) { flag7 = true; __instance.agent.specialAbilityIndicator.ShowIndicator(agent6, "Possess"); } } if (!flag7) { __instance.agent.specialAbilityIndicator.Revert(); } } else if (specialAbility == vSpecialAbility.MechTransformation) { bool flag8 = false; if (__instance.agent.arrestingAgent == null && __instance.agent.inventory.equippedSpecialAbility.invItemCount == 0 && __instance.CanShowSpecialAbilityIndicator()) { Agent agent7 = (Agent)__instance.FindSpecialAbilityObject(); if (agent7 != null) { __instance.agent.specialAbilityIndicator.ShowIndicator(agent7, "MechTransform"); flag8 = true; } } if (!flag8) { __instance.agent.specialAbilityIndicator.Revert(); } } else if (specialAbility == "InvisibleLimitedItem") { if (__instance.agent.invisible) { __instance.agent.inventory.buffDisplay.specialAbilitySlot.MakeNotUsable(); } else if (__instance.agent.inventory.equippedSpecialAbility.invItemCount > 0) { __instance.agent.inventory.buffDisplay.specialAbilitySlot.MakeNotUsable(); } else if (__instance.CanShowSpecialAbilityIndicator()) { bool flag9 = true; for (int i = 0; i < GC.activeBrainAgentList.Count; i++) { Agent agent8 = GC.activeBrainAgentList[i]; if (agent8 != __instance.agent && !agent8.dead) { Relationship relationship = agent8.relationships.GetRelationship(__instance.agent); if (relationship.HasLOS("") && relationship.relType != "Aligned" && relationship.relType != "Loyal" && agent8.employer != __instance.agent && !agent8.oma.hidden) { __instance.agent.inventory.buffDisplay.specialAbilitySlot.MakeNotUsable(); flag9 = false; break; } } } if (flag9) { for (int j = 0; j < GC.objectRealList.Count; j++) { if (GC.objectRealList[j].objectName == "SecurityCam") { SecurityCam securityCam = (SecurityCam)GC.objectRealList[j]; if (securityCam.agentsInView.Contains(__instance.agent) && !securityCam.destroyed && securityCam.functional) { __instance.agent.inventory.buffDisplay.specialAbilitySlot.MakeNotUsable(); flag9 = false; break; } } } } if (flag9) { __instance.agent.inventory.buffDisplay.specialAbilitySlot.MakeUsable(); } } } } yield return(new WaitForSeconds(0.1f)); } while (__instance.startedSpecialAbilityInterfaceCheck); } #endregion if ((__instance.agent.HasTrait <Sniper>() || __instance.agent.HasTrait <Sniper2>()) && __instance.agent.agentInvDatabase.equippedWeapon.invItemName == vItem.Revolver) { // Test for reduced range if hidden foreach (Agent targetAgent in GC.agentList) { if (!targetAgent.dead && !targetAgent.ghost && __instance.agent.movement.HasLOSAgent360(targetAgent) && __instance.agent.movement.GetDistance(__instance.agent.gameObject, targetAgent.gameObject) > 6f) { __instance.agent.specialAbilityIndicator.ShowIndicator(targetAgent, "Chloroform"); // Placeholder for new sprite } } } yield break; }