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); } } } }
private IEnumerator StageLight() { foreach (List <PartModule> stageList in SliceLightList()) { SwitchLight.On(stageList); if (settings.useRandomDelay) { yield return(new WaitForSeconds(UnityEngine.Random.Range(.4f, 2f))); } else { yield return(new WaitForSeconds(settings.delayStage)); } } }
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; } }
public override void OnStart(StartState state) { if ((!HighLogic.CurrentGame.Parameters.CustomParams <CL_GeneralSettings> ().useMotionDetector) /* || (!part.Modules.Contains<ModuleLight> ())*/) { Events ["SetMotionDetector"].active = false; this.enabled = false; return; } inTheEditor = false; if (state == StartState.Editor) { inTheEditor = true; } useOffset = false; if (part.name == "spotLight1" || part.name == "spotLight2") { useOffset = true; } showGUI = false; windowRect = new Rect(0, 0, 120f, 180f); symParts = new List <Part> (part.symmetryCounterparts); part.symmetryCounterparts.Clear(); lights = new List <PartModule> (SwitchLight.GetLightModule(part)); lightIsOn = SwitchLight.IsOn(lights); part.symmetryCounterparts = symParts; // Create the cone : detectionCone = GameObject.CreatePrimitive(PrimitiveType.Sphere); detectionCone.layer = 4; //was 1, changed in 1.17 for ksp 1.5.1 detectionCone.transform.SetParent(lights[0].transform); detectionCone.transform.position = lights[0].transform.position; Color coneColor = Color.yellow; coneColor.a = .3f; MeshRenderer coneRenderer = detectionCone.GetComponent <MeshRenderer> (); coneRenderer.material = new Material(Shader.Find("Transparent/Diffuse")); coneRenderer.material.color = coneColor; detectionCone.GetComponent <SphereCollider> ().isTrigger = true; ToggleMeshRenderer(false); if (inTheEditor) { detectionCone.GetComponent <SphereCollider> ().enabled = false; // dont think this is needed anymore, due to the change of layer } else { logicModule = detectionCone.AddComponent <LogicMotionDetector> (); //lightIsOn = SwitchLight.IsOn (lights); } rangeNew = range; timerNew = timer; applyToSymPartNew = applyToSymPart; ResetGUIName(); UpdateMeshScale(); ResetSymmetry(); GameEvents.onEditorSymmetryModeChange.Add(ResetSymmetry); GameEvents.onEditorPartEvent.Add(ResetSymmetry); }
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); }