Ejemplo n.º 1
0
    //private Color defaultEmissiveColor;
    //private bool clicked = false;

    /// <summary>
    /// triggered by FSswitchButtonHandler
    /// </summary>
    /// <param name="buttonNumber">If there are several buttons tied to this module, this would tell them apart</param>
    public void buttonClick() //(int buttonNumber)
    {
        //set emissive color if used when clicked, start countdown to reset emissive if that applies
        if (useEmissiveToggle == 1)
        {
            switchObjectTransform.renderer.material.SetColor("_EmissiveColor", new Color(onEmissiveColor.x, onEmissiveColor.y, onEmissiveColor.z));
            //switchObjectTransform.renderer.material.SetColor("_EmissiveColor", Color.yellow);
            emissiveCountdown = resetEmissiveTime;
        }


        //Debug.Log("FS switch " + buttonNumber + " clicked");
        if (!customAction)
        {
            FlightGlobals.ActiveVessel.ActionGroups.ToggleGroup(actionGroup);
        }
        else
        {
            switch (groupName)
            {
            case "engine":
                foreach (Part part in vessel.Parts)
                {
                    ModuleEngines engine = part.Modules.OfType <ModuleEngines>().FirstOrDefault();
                    if (engine != null)
                    {
                        engine.EngineIgnited = !engine.EngineIgnited;
                    }
                }
                break;

            case "hover":
                foreach (Part part in vessel.Parts)
                {
                    FScopterThrottle copterEngine = part.Modules.OfType <FScopterThrottle>().FirstOrDefault();
                    if (copterEngine != null)
                    {
                        copterEngine.toggleHover();
                        if (postMessagesToScreen == 1)
                        {
                            ScreenMessages.PostScreenMessage(new ScreenMessage("hover height set to " + Math.Round(copterEngine.hoverHeight, 1), 2f, ScreenMessageStyle.UPPER_CENTER));
                        }
                        Debug.Log("FS: hover height set to " + copterEngine.hoverHeight);
                    }
                }
                break;

            case "Stage":
                //FlightGlobals.ActiveVessel.ResumeStaging();
                //StageManager.ActivateNextStage();
                break;

            case "resetTrim":
                FlightInputHandler.state.yawTrim = 0f;
                break;
            }
        }
    }
Ejemplo n.º 2
0
 public void getHoverHeight()
 {
     hoverHeight = 0f;
     foreach (Part part in vessel.Parts)
     {
         FScopterThrottle copterEngine = part.Modules.OfType <FScopterThrottle>().FirstOrDefault();
         if (copterEngine != null)
         {
             //copterEngine.toggleHover();
             hoverHeight = copterEngine.hoverHeight;
         }
     }
 }