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
 internal override void postControllerSetup()
 {
     base.postControllerSetup();
     setupAnimationController();
     lightModule = part.GetComponent <ModuleLight>();
     if (lightModule != null && controller.wheelState == KSPWheelState.DEPLOYED)
     {
         lightModule.LightsOn();
     }
     if (vessel != null)
     {
         vessel.ActionGroups.SetGroup(KSPActionGroup.Gear, controller.wheelState == KSPWheelState.DEPLOYED);
     }
     if (!string.IsNullOrEmpty(tempColliderName))
     {
         tempColliderTransform = part.transform.FindChildren(tempColliderName)[wheelData.indexInDuplicates];
     }
 }
Ejemplo n.º 4
0
        public static void On(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.LightsOn();
                break;

            case "ModuleAnimateGeneric":
            case "ModuleAnimateGenericConsumer":
                ModuleAnimateGeneric castMAG = (ModuleAnimateGeneric)light;
                if (castMAG.animSwitch)
                {
                    castMAG.Toggle();
                }
                break;

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

            case "ModuleKELight":
                light.GetType().InvokeMember("LightsOn", BindingFlags.InvokeMethod, null, light, null);
                break;
            }
        }
Ejemplo n.º 5
0
        public static void On(PartModule light)
        {
            if (!settingsLoaded)
            {
                LoadSettings();
            }

            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.LightsOn();
                break;

            case "ModuleAnimateGeneric":
            case "ModuleAnimateGenericConsumer":
                ModuleAnimateGeneric castMAG = (ModuleAnimateGeneric)light;
                if (castMAG.animSwitch)
                {
                    castMAG.Toggle();
                }
                break;

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

            case "ModuleNavLight":
                if (generalSettings.useAviationLightsEffect && GameSettingsLive.inSunlight)
                {
                    switch (light.part.name)
                    {
                    case "lightbeacon.amber":
                        light.GetType().InvokeMember("navLightSwitch", BindingFlags.SetField, null, light,
                                                     new object[] { ParseNavLightStr(aviationLSettings.beaconAmber) });
                        break;

                    case "lightbeacon.red":
                        light.GetType().InvokeMember("navLightSwitch", BindingFlags.SetField, null, light,
                                                     new object[] { ParseNavLightStr(aviationLSettings.beaconRed) });
                        break;

                    case "lightnav.blue":
                        light.GetType().InvokeMember("navLightSwitch", BindingFlags.SetField, null, light,
                                                     new object[] { ParseNavLightStr(aviationLSettings.navBlue) });
                        break;

                    case "lightnav.green":
                        light.GetType().InvokeMember("navLightSwitch", BindingFlags.SetField, null, light,
                                                     new object[] { ParseNavLightStr(aviationLSettings.navGreen) });
                        break;

                    case "lightnav.red":
                        light.GetType().InvokeMember("navLightSwitch", BindingFlags.SetField, null, light,
                                                     new object[] { ParseNavLightStr(aviationLSettings.navRed) });
                        break;

                    case "lightnav.white":
                        light.GetType().InvokeMember("navLightSwitch", BindingFlags.SetField, null, light,
                                                     new object[] { ParseNavLightStr(aviationLSettings.navWhite) });
                        break;

                    case "lightstrobe.white":
                        light.GetType().InvokeMember("navLightSwitch", BindingFlags.SetField, null, light,
                                                     new object[] { ParseNavLightStr(aviationLSettings.strobeWhite) });
                        break;

                    default:
                        light.GetType().InvokeMember("navLightSwitch", BindingFlags.SetField, null, light,
                                                     new object[] { 4 });
                        break;
                    }
                }
                else
                {
                    light.GetType().InvokeMember("navLightSwitch", BindingFlags.SetField, null, light, new object[] { 4 });
                }
                break;

            case "ModuleKELight":
                light.GetType().InvokeMember("LightsOn", BindingFlags.InvokeMethod, null, light, null);
                break;
            }
        }