Ejemplo n.º 1
0
 internal override void Toggle()
 {
     if (lightModule.isOn)
     {
         if (action == ActionType.Toggle || action == ActionType.Deactivate)
         {
             lightModule.LightsOff();
         }
     }
     else
     {
         if (action == ActionType.Toggle || action == ActionType.Activate)
         {
             lightModule.LightsOn();
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Callback from animationControl for when an animation transitions from one state to another
 /// </summary>
 /// <param name="state"></param>
 public void onAnimationStateChanged(KSPWheelState state)
 {
     changeWheelState(state);
     if (state == KSPWheelState.RETRACTED)
     {
         //TODO reset suspension and steering transforms to neutral?
         if (lightModule != null)
         {
             lightModule.LightsOff();
         }
         if (!string.IsNullOrEmpty(retractEffect))
         {
             part.Effect(retractEffect, 0f);
         }
         if (!string.IsNullOrEmpty(retractedEffect))
         {
             part.Effect(retractedEffect, 1f);
         }
         if (!string.IsNullOrEmpty(deployEffect))
         {
             part.Effect(deployEffect, 0f);
         }
         if (!string.IsNullOrEmpty(deployedEffect))
         {
             part.Effect(deployedEffect, 0f);
         }
     }
     else if (state == KSPWheelState.DEPLOYED)
     {
         if (lightModule != null)
         {
             lightModule.LightsOn();
         }
         if (!string.IsNullOrEmpty(retractEffect))
         {
             part.Effect(retractEffect, 0f);
         }
         if (!string.IsNullOrEmpty(retractedEffect))
         {
             part.Effect(retractedEffect, 0f);
         }
         if (!string.IsNullOrEmpty(deployEffect))
         {
             part.Effect(deployEffect, 0f);
         }
         if (!string.IsNullOrEmpty(deployedEffect))
         {
             part.Effect(deployedEffect, 1f);
         }
     }
     if (HighLogic.LoadedSceneIsEditor)
     {
         GameEvents.onEditorShipModified.Fire(EditorLogic.fetch.ship);
     }
 }
Ejemplo n.º 3
0
        public static void Off(PartModule light)
        {
            switch (light.moduleName)
            {
            case "ModuleColorChanger":
            case "ModuleColorChangerConsumer":
                ModuleColorChanger castMCC = (ModuleColorChanger)light;
                if (castMCC.animState)
                {
                    castMCC.ToggleEvent();
                }
                break;

            case "ModuleLight":
            case "ModuleStockLightColoredLens":
            case "ModuleMultiPointSurfaceLight":
            case "ModuleColoredLensLight":
                ModuleLight castML = (ModuleLight)light;
                castML.LightsOff();
                break;

            case "ModuleAnimateGeneric":
            case "ModuleAnumateGenericConsumer":
                ModuleAnimateGeneric castMAG = (ModuleAnimateGeneric)light;
                castMAG.Toggle();
                break;

            case "WBILight":
                light.GetType().InvokeMember("TurnOffLights", BindingFlags.InvokeMethod, null, light, null);
                break;

            case "ModuleNavLight":
                light.GetType().InvokeMember("navLightSwitch", BindingFlags.SetField, null, light, new object[] { 0 });
                break;

            case "ModuleKELight":
                light.GetType().InvokeMember("LightsOff", BindingFlags.InvokeMethod, null, light, null);
                break;
            }
        }
Ejemplo n.º 4
0
 public static void DeactivateModule(this ModuleLight module)
 {
     module.LightsOff();
     module.Events["LightsOn"].active = module.Events["LightsOn"].guiActive = false;
     module.isEnabled = false;
 }