private Task LockDown173(KeyValuePair <RoleType, int> scp) { Synapse.Api.Door connectorDoor173 = Synapse.Api.Map.Get.Doors.First((e) => e.DoorType == Synapse.Api.Enum.DoorType.LCZ_173_Connector); connectorDoor173.Locked = true; _runningCoroutines.Add(Timing.CallDelayed(scp.Value, () => { connectorDoor173.Locked = false; ToggleLockdownState(RoleType.Scp173); foreach (var player in Synapse.Server.Get.Players.Where((player) => player.RoleType == RoleType.Scp173)) { player.GiveTextHint("You're good to go!"); } })); return(Task.CompletedTask); }
private Task LockDown096(KeyValuePair <RoleType, int> scp) { SynapseDoor door096 = Server.Get.Map.Doors.First((e) => e.Name == "096"); SynapseDoor nearestDoor = Server.Get.Map.Doors.GetClosestDoor(door096); nearestDoor.Locked = true; _runningCoroutines.Add(Timing.CallDelayed(scp.Value, () => { nearestDoor.Locked = false; ToggleLockdownState(RoleType.Scp096); foreach (var player in Server.Get.Players.Where((player) => player.RoleType == RoleType.Scp096)) { player.GiveTextHint("You're good to go!"); } })); return(Task.CompletedTask); }
public static SynapseDoor GetClosestDoor( this IEnumerable <SynapseDoor> doors, SynapseDoor relativeDoor, bool onlyHeavyDoors = false, IEnumerable <SynapseDoor> ignoreDoors = null ) { ignoreDoors = ignoreDoors ?? Enumerable.Empty <SynapseDoor>(); SynapseDoor result = null; float closestDistanceSqr = Mathf.Infinity; Vector3 currentPosition = relativeDoor.Position; foreach (SynapseDoor potentialDoor in doors) { if (onlyHeavyDoors && !potentialDoor.DoorType.IsHeavy()) { continue; } if (ignoreDoors.Contains(potentialDoor)) { continue; } if (potentialDoor == relativeDoor) { continue; } Vector3 directionToTarget = potentialDoor.Position - currentPosition; float dSqrToTarget = directionToTarget.sqrMagnitude; if (dSqrToTarget < closestDistanceSqr) { closestDistanceSqr = dSqrToTarget; result = potentialDoor; } } return(result); }