Exemplo n.º 1
0
    //private bool showMenu = false;
    //private Rect windowRect = new Rect(500f, 250f, 250f, 50f);
    //private FSGUIPopup popup;

    public override void OnStart(PartModule.StartState state)
    {
        engine = part.Modules.OfType <ModuleEngines>().FirstOrDefault();
        if (engine != null)
        {
            //Debug.Log("FSswitchEngineThrustTransform: Engine module found");
            thrustTransform         = part.FindModelTransform(defaultTTName);
            defaultTT               = new GameObject().transform;
            defaultTT.localPosition = thrustTransform.localPosition;
            defaultTT.localRotation = thrustTransform.localRotation;
            //defaultTT = part.FindModelTransform(defaultTTName);
            if (useNamedAlternate == 1)
            {
                alternateTT = part.FindModelTransform(alternateTTName);
            }
            else
            {
                alternateTT = new GameObject().transform;
                alternateTT.localPosition = defaultTT.localPosition;
                alternateTT.localRotation = defaultTT.localRotation;
                alternateTT.Rotate(alternateTT.right, 180f);
            }
            if (defaultTT == null || alternateTT == null)
            {
                valid = false;
            }

            if (isReversed)
            {
                setTTReverseState(true);
            }
            else
            {
                setTTReverseState(false);
            }
        }
        else
        {
            valid = false;
            Debug.Log("FSswitchEngineThrustTransform: no engine module found");
        }

        animateThrottle = part.Modules.OfType <FSanimateThrottle>().FirstOrDefault();
        if (animateThrottle != null)
        {
            animateThrottle.modeList.Add(new mode(animateThrottleRange.x, animateThrottleRange.y));
            animateThrottleMode = animateThrottle.modeList.Count - 1;
        }
    }
    //private bool showMenu = false;
    //private Rect windowRect = new Rect(500f, 250f, 250f, 50f);
    //private FSGUIPopup popup;
    public override void OnStart(PartModule.StartState state)
    {
        engine = part.Modules.OfType<ModuleEngines>().FirstOrDefault();
            if (engine != null)
            {
                //Debug.Log("FSswitchEngineThrustTransform: Engine module found");
                thrustTransform = part.FindModelTransform(defaultTTName);
                defaultTT = new GameObject().transform;
                defaultTT.localPosition = thrustTransform.localPosition;
                defaultTT.localRotation = thrustTransform.localRotation;
                //defaultTT = part.FindModelTransform(defaultTTName);
                if (useNamedAlternate == 1)
                {
                    alternateTT = part.FindModelTransform(alternateTTName);
                }
                else
                {
                    alternateTT = new GameObject().transform;
                    alternateTT.localPosition = defaultTT.localPosition;
                    alternateTT.localRotation = defaultTT.localRotation;
                    alternateTT.Rotate(alternateTT.right, 180f);
                }
                if (defaultTT == null || alternateTT == null) valid = false;

                if (isReversed)
                {
                    setTTReverseState(true);
                }
                else
                {
                    setTTReverseState(false);
                }
            }
            else
            {
                valid = false;
                Debug.Log("FSswitchEngineThrustTransform: no engine module found");
            }

            animateThrottle = part.Modules.OfType<FSanimateThrottle>().FirstOrDefault();
            if (animateThrottle != null)
            {
                animateThrottle.modeList.Add(new mode(animateThrottleRange.x, animateThrottleRange.y));
                animateThrottleMode = animateThrottle.modeList.Count - 1;
            }
    }