Ejemplo n.º 1
0
        public override void OnStart(StartState state)
        {
            if (state == StartState.Editor) return;
            part.force_activate ();

            // create objects
            visualHelper = new VisualHelper (this.vessel.transform);
            if (gnc == null) {
                flightData = new FlightData ();
                bus = new Bus ();
                gnc = new GNC (flightData, bus, this);
            }
            teleporter = new Teleporter (flightData);

            // register gui handler
            RenderingManager.AddToPostDrawQueue (0, new Callback (drawGUI));
        }
Ejemplo n.º 2
0
        //
        // public methods
        //
        public GNC(FlightData fd, Bus b, ORDA_computer p)
        {
            parent = p;
            flightData = fd;
            bus = b;

            Kp_AngVel = Default_Kp_AngVel = p.default_Kp_AngVel;
            Kp_AngAcc = Default_Kp_AngAcc = p.default_Kp_AngAcc;
            Kp_Vel = Default_Kp_Vel = p.default_Kp_Vel;
            Kp_Acc = Default_Kp_Acc = p.default_Kp_Acc;
        }
Ejemplo n.º 3
0
        public override void OnLoad(ConfigNode node)
        {
            // get config node
            ConfigNode n = node.GetNode ("config");
            if (n == null) {
                return;
            }

            // gnc config
            if (n.HasValue ("gncConfig")) {
                try {
                    string gncConfigString = n.GetValue ("gncConfig");
                    GNCconfig gncConfig = (GNCconfig)KSP.IO.IOUtils.DeserializeFromBinary (Convert.FromBase64String (gncConfigString.Replace ("*", "=").Replace ("|", "/")));
                    // OnStart not been called yet?
                    if(gnc == null) {
                        flightData = new FlightData ();
                        bus = new Bus ();
                        gnc = new GNC (flightData, bus, this);
                    }
                    gnc.restoreConfiguration (gncConfig);
                } catch (Exception e) {
                    print ("ORDA_computer.OnLoad: gnc exception: " + e.ToString());
                }
            }

            // gui config
            if (n.HasValue ("guiConfig")) {
                try {
                    string guiConfigString = n.GetValue ("guiConfig");
                    GUIconfig guiConfig = (GUIconfig)KSP.IO.IOUtils.DeserializeFromBinary (Convert.FromBase64String (guiConfigString.Replace ("*", "=").Replace ("|", "/")));
                    restoreGUIConfiguration (guiConfig);
                } catch (Exception e) {
                    print ("ORDA_computer.OnLoad: gui exception: " + e.ToString());
                }
            }
        }