コード例 #1
0
ファイル: KASAddonDebugTools.cs プロジェクト: ACCBizon/KAS
        public void Update()
        {
            if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.K))
            {
                if (GuiConfigToogle)
                {
                    Debug.Log("KASAddonDebugMenu - Closing KAS debug tools");
                    GuiConfigToogle = false;
                }
                else
                {
                    Debug.Log("KASAddonDebugMenu - Opening KAS debug tools");
                    GuiConfigToogle = true;
                }
            }

            if (GuiConfigToogle)
            {
                if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.Mouse0))
                {
                    Debug.Log("KASAddonDebugMenu - On click");
                    clickedPart = KAS_Shared.GetPartUnderCursor();
                    if (clickedPart)
                    {
                        moduleWinch = null;
                        moduleGrab = null;
                        moduleMagnet = null;
                        moduleSuctionCup = null;
                        moduleGrapple = null;
                        moduleTimedBomb = null;
                        modulePort = null;
                        moduleAnchor = null;
                        moduleStrut = null;
                        moduleRotor = null;

                        moduleWinch = clickedPart.GetComponent<KASModuleWinch>();
                        moduleGrab = clickedPart.GetComponent<KASModuleGrab>();
                        moduleMagnet = clickedPart.GetComponent<KASModuleMagnet>();
                        moduleSuctionCup = clickedPart.GetComponent<KASModuleSuctionCup>();
                        moduleGrapple = clickedPart.GetComponent<KASModuleGrapplingHook>();
                        moduleTimedBomb = clickedPart.GetComponent<KASModuleTimedBomb>();
                        modulePort = clickedPart.GetComponent<KASModulePort>();
                        moduleAnchor = clickedPart.GetComponent<KASModuleAnchor>();
                        moduleStrut = clickedPart.GetComponent<KASModuleStrut>();
                        moduleRotor = clickedPart.GetComponent<KASModuleRotor>();
                    }     
                }
            }

            if (FlightGlobals.ActiveVessel.heightFromTerrain == -1f)
            {
                if (FlightGlobals.ActiveVessel.Landed)
                {
                    KAS_Shared.DebugWarning("Warning ! ActiveVessel is landed and heightFromTerrain are negative (" + FlightGlobals.ActiveVessel.heightFromTerrain + ")");
                }
            }
        }
コード例 #2
0
        public void Update()
        {
            if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.K))
            {
                if (GuiConfigToogle)
                {
                    Debug.Log("KASAddonDebugMenu - Closing KAS debug tools");
                    GuiConfigToogle = false;
                }
                else
                {
                    Debug.Log("KASAddonDebugMenu - Opening KAS debug tools");
                    GuiConfigToogle = true;
                }
            }

            if (GuiConfigToogle)
            {
                if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.Mouse0))
                {
                    Debug.Log("KASAddonDebugMenu - On click");
                    clickedPart = KAS_Shared.GetPartUnderCursor();
                    if (clickedPart)
                    {
                        moduleWinch      = null;
                        moduleGrab       = null;
                        moduleMagnet     = null;
                        moduleSuctionCup = null;
                        moduleGrapple    = null;
                        moduleTimedBomb  = null;
                        modulePort       = null;
                        moduleAnchor     = null;
                        moduleStrut      = null;
                        moduleRotor      = null;

                        moduleWinch      = clickedPart.GetComponent <KASModuleWinch>();
                        moduleGrab       = clickedPart.GetComponent <KASModuleGrab>();
                        moduleMagnet     = clickedPart.GetComponent <KASModuleMagnet>();
                        moduleSuctionCup = clickedPart.GetComponent <KASModuleSuctionCup>();
                        moduleGrapple    = clickedPart.GetComponent <KASModuleGrapplingHook>();
                        moduleTimedBomb  = clickedPart.GetComponent <KASModuleTimedBomb>();
                        modulePort       = clickedPart.GetComponent <KASModulePort>();
                        moduleAnchor     = clickedPart.GetComponent <KASModuleAnchor>();
                        moduleStrut      = clickedPart.GetComponent <KASModuleStrut>();
                        moduleRotor      = clickedPart.GetComponent <KASModuleRotor>();
                    }
                }
            }

            if (FlightGlobals.ActiveVessel.heightFromTerrain == -1f)
            {
                if (FlightGlobals.ActiveVessel.Landed)
                {
                    KAS_Shared.DebugWarning("Warning ! ActiveVessel is landed and heightFromTerrain are negative (" + FlightGlobals.ActiveVessel.heightFromTerrain + ")");
                }
            }
        }