private IEnumerator StartMorseLight() { yield return(StartCoroutine("FindLightPart")); double vesselDistance = GetDistance(); while (vesselDistance > CLSettings.distance) { if (vesselDistance > offLimit) { Destroy(this); } yield return(new WaitForSeconds(.5f)); vesselDistance = GetDistance(); } SwitchLight.Off(modulesLight); yield return(new WaitForSeconds(CLSettings.ditDuration)); // Morse message foreach (int c in CLSettings.morseCode) { switch (c) { case 0: SwitchLight.On(modulesLight); yield return(new WaitForSeconds(CLSettings.ditDuration)); break; case 1: SwitchLight.On(modulesLight); yield return(new WaitForSeconds(CLSettings.dahDuration)); break; case 2: SwitchLight.Off(modulesLight); yield return(new WaitForSeconds(CLSettings.letterSpaceDuration)); break; case 3: SwitchLight.Off(modulesLight); yield return(new WaitForSeconds(CLSettings.wordSpaceDuration)); break; case 4: SwitchLight.Off(modulesLight); yield return(new WaitForSeconds(CLSettings.symbolSpaceDuration)); break; } } LightPreviousState(); Destroy(this); }
private void LightPreviousState() { // Settings lights to theirs previous state if (stateLight != null && modulesLight != null) { int i = 0; foreach (bool?isOn in stateLight) { if (isOn == null) { if (modulesLight[i].part.CrewCapacity > 0) { if (modulesLight[i].part.protoModuleCrew.Count > 0) { SwitchLight.On(modulesLight[i].part); } else { SwitchLight.Off(modulesLight [i].part); } } } else if (isOn == true) { SwitchLight.On(modulesLight [i].part); } else { SwitchLight.Off(modulesLight [i].part); } i++; } } }
private void CrewLightTransfer(GameEvents.HostedFromToAction <ProtoCrewMember, Part> eData) { SwitchLight.On(eData.to); if (eData.from.protoModuleCrew.Count == 0) { SwitchLight.Off(eData.from); } }
public void FixedUpdate() { if (part.vessel.ctrlState.mainThrottle > 0 && !isOn) { SwitchLight.On(navLight); isOn = true; return; } if (part.vessel.ctrlState.mainThrottle == 0 && isOn) { SwitchLight.Off(navLight); isOn = false; } }
private void SetLights() { // Depth Lights : if (CLSettings.useDepthLight) { if (IsInDepth()) { if (!inDark) { if (CLSettings.useSunLight) { StartCoroutine("StageLight"); } else { SwitchLight.On(modulesLight); } inDark = true; } return; } } // Sun Lights : if (IsSunShine()) { if (inDark) { StopCoroutine("StageLight"); SwitchLight.Off(modulesLight); inDark = false; } } else { if (!inDark) { if (CLSettings.useStaggerdLight) { StartCoroutine("StageLight"); } else { SwitchLight.On(modulesLight); } inDark = true; } } }
private IEnumerator StageLight() { foreach (List <PartModule> stageList in SliceLightList()) { SwitchLight.On(stageList); if (CLSettings.useRandomDelay) { yield return(new WaitForSeconds(UnityEngine.Random.Range(.4f, 2f))); } else { yield return(new WaitForSeconds(CLSettings.delayStage)); } } }
private IEnumerator CrewLightVesselRoutine(Vessel vessel) { yield return(new WaitForSeconds(.1f)); if (vessel.crewedParts != 0 && vessel.isEVA == false) { foreach (ProtoCrewMember crewMember in vessel.GetVesselCrew()) { if (crewMember.KerbalRef != null) // If this is false it should means the Kerbal is in a Command Seat { SwitchLight.On(crewMember.KerbalRef.InPart); } } } }
public override void OnUpdate() { // Logic stuff : if (motionDetectorEnabled) { if (lightIsOn != logicModule.lightToggle) { symParts = new List <Part> (part.symmetryCounterparts); part.symmetryCounterparts.Clear(); if (lightIsOn) { SwitchLight.Off(lights); lightIsOn = false; } else { SwitchLight.On(lights); lightIsOn = true; } part.symmetryCounterparts = symParts; } } }
public void LightToggleEVA() { if (!generalSettings.lightSymLights) { // Remove the symmetry counter parts before lightning, then add them back part.symmetryCounterparts.Clear(); } if (part.Modules.Contains <ModuleLight> ()) { List <ModuleLight> lights = part.Modules.GetModules <ModuleLight> (); foreach (ModuleLight light in lights) { if (light.isOn) { SwitchLight.Off(light); } else { SwitchLight.On(light); } } } if (part.Modules.Contains("ModuleKELight")) { foreach (PartModule partM in part.Modules) { if (partM.ClassName == "ModuleKELight") { if ((bool)partM.GetType().InvokeMember("isOn", System.Reflection.BindingFlags.GetField, null, partM, null)) { SwitchLight.Off(part); } else { SwitchLight.On(part); } } } } if (part.Modules.Contains("ModuleNavLight")) { foreach (PartModule partM in part.Modules) { if (partM.ClassName == "ModuleNavLight") { if ((int)partM.GetType().InvokeMember("navLightSwitch", System.Reflection.BindingFlags.GetField, null, partM, null) != 0) { SwitchLight.Off(part); } else { SwitchLight.On(part); } } } } if (!generalSettings.lightSymLights) { part.symmetryCounterparts = ogSymPart; } }
private IEnumerator StartMorseLight() { isRunning = true; yield return(StartCoroutine("FindLightPart")); double vesselDistance = GetDistance(); while (vesselDistance > settings.distance) { if (vesselDistance > offLimit) { Destroy(this); } yield return(timer); vesselDistance = GetDistance(); } SwitchLight.Off(modulesLight); yield return(new WaitForSeconds(settings.ditDuration)); // Morse message foreach (MorseCode c in GameSettingsLive.morseCode) { switch (c) { case MorseCode.dih: SwitchLight.On(modulesLight); yield return(new WaitForSeconds(settings.ditDuration)); break; case MorseCode.dah: SwitchLight.On(modulesLight); yield return(new WaitForSeconds(settings.dahDuration)); break; case MorseCode.letterspc: SwitchLight.Off(modulesLight); yield return(new WaitForSeconds(settings.letterSpaceDuration)); break; case MorseCode.wordspc: SwitchLight.Off(modulesLight); yield return(new WaitForSeconds(settings.wordSpaceDuration)); break; case MorseCode.symspc: SwitchLight.Off(modulesLight); yield return(new WaitForSeconds(settings.symbolSpaceDuration)); break; } } LightPreviousState(); isRunning = false; Destroy(this); }