public void activateScanner(float zoom, Rect screen_rect) { Debug.Log("ImpulseDrive: PlanetScanner activateScanner 1 "); //this.CameraProbe = null; //this.pScannScreen = null; PlanetScanner_initialize(screen_rect); Debug.Log("ImpulseDrive: PlanetScanner activateScanner 2 "); zoomFactor = zoom; Camera_hinge.transform.parent = this.CurrentMotherShip.transform; // ...child to our part... Camera_hinge.transform.localPosition = Vector3.zero; Camera_hinge.transform.localEulerAngles = Vector3.zero; Vector3 gee = FlightGlobals.getGeeForceAtPosition(this.CurrentMotherShip.transform.position); Camera_hinge.transform.rotation = Quaternion.LookRotation(gee.normalized); Debug.Log("ImpulseDrive: PlanetScanner activateScanner 3 "); CameraProbe.transform.parent = Camera_hinge.transform; // ...child to our part... CameraProbe.transform.localPosition = Vector3.zero; CameraProbe.transform.localEulerAngles = Vector3.zero; Debug.Log("ImpulseDrive: PlanetScanner activateScanner 4 "); if (gimbalDebug2 != null) { gimbalDebug2.removeGimbal(); } if (gimbalDebug2 == null) { gimbalDebug2 = new GimbalDebug(); } else { gimbalDebug2.removeGimbal(); } gimbalDebug2.drawGimbal(CameraProbe, 3, 0.2f); Debug.Log("ImpulseDrive: PlanetScanner activateScanner 5 "); float heightFromSurface = ((float)this.CurrentMotherShip.altitude - this.CurrentMotherShip.heightFromTerrain < 0F) ? (float)this.CurrentMotherShip.altitude : this.CurrentMotherShip.heightFromTerrain; heightFromSurface = (heightFromSurface != -1) ? heightFromSurface : (float)this.CurrentMotherShip.altitude; fixed_height = heightFromSurface - (2000 / zoom); CameraProbe.transform.localPosition = Vector3.forward * fixed_height; Debug.Log("ImpulseDrive: PlanetScanner activateScanner 6 "); float vFOVrad = CameraProbe.camera.fieldOfView * Mathf.Deg2Rad; float cameraHeightAt1 = Mathf.Tan(vFOVrad * .5f); float picWidth = (heightFromSurface - fixed_height) * 0.866025f; if (heightFromSurface > 100000F) { GUILayout.Label("PlanetScanner out of Range - max range 50Km"); } else { GUILayout.Label("foo4"); GUILayout.BeginHorizontal(); CameraDisplayTexture = RTImage(CameraProbe.camera); content = new GUIContent(CameraDisplayTexture, ""); GUILayout.Box(content, GUILayout.Height(260), GUILayout.Width(260)); GUILayout.Label(""); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); //PlanetScannerWindowPosition = LCARS_Utilities.ClampToScreen(GUI.Window(PlanetScannerWindowID, PlanetScannerWindowPosition, PlanetScannerWindow, "")); } //Debug.Log("ImpulseDrive: PlanetScanner activateScanner 4 "); GUILayout.Label("picWidth=" + picWidth); GUILayout.Label(this.CurrentMotherShip.RevealSituationString()); GUILayout.Label(this.CurrentMotherShip.latitude + " lat /" + this.CurrentMotherShip.longitude + "lon"); if ((Time.time - lastFixedUpdate) > logInterval) { Debug.Log("ImpulseDrive: PlanetScanner UnloadUnusedAssets"); Resources.UnloadUnusedAssets(); lastFixedUpdate = Time.time; } float power = PT.L1_usage + PT.L2_usage; this.PowSys.draw(PT.takerName, power); }
private void GUI_ShipToEVA(Rect screen_rect) { //Debug.LogError("GUI_ShipToEVA begin : TransportMode=" + this.TransportMode); if (this.ShipToEVASubMode == null) { //Debug.LogError("GUI_ShipToEVA 1 : ShipToEVASubMode=" + this.ShipToEVASubMode); if (GUILayout.Button("Back")) { this.TransportMode = null; this.ShipToEVASubMode = null; } GUILayout.Label("Selet Target Location: "); if (GUILayout.Button("Ship To Ground")) { this.ShipToEVASubMode = "ShipToGround"; //Debug.LogError("GUI_ShipToEVA Button1 : ShipToEVASubMode=" + this.ShipToEVASubMode); } if (GUILayout.Button("Ship To Space")) { this.ShipToEVASubMode = "ShipToSpace"; //Debug.LogError("GUI_ShipToEVA Button2 : ShipToEVASubMode=" + this.ShipToEVASubMode); } } else { if (GUILayout.Button("Back")) { this.ShipToEVASubMode = null; } switch (this.ShipToEVASubMode) { case "ShipToGround": transporter_hinge.transform.parent = this.CurrentMotherShip.transform; // ...child to our part... transporter_hinge.transform.localPosition = Vector3.zero; transporter_hinge.transform.localEulerAngles = Vector3.zero; Vector3 gee = FlightGlobals.getGeeForceAtPosition(this.CurrentMotherShip.transform.position); transporter_hinge.transform.rotation = Quaternion.LookRotation(gee.normalized); transporter_target.transform.parent = transporter_hinge.transform; // ...child to our part... transporter_target.transform.localPosition = Vector3.zero; transporter_target.transform.localEulerAngles = Vector3.zero; if (gimbalDebug2 == null) { gimbalDebug2 = new GimbalDebug(); } else { gimbalDebug2.removeGimbal(); } gimbalDebug2.drawGimbal(transporter_target, 3, 0.2f); float heightFromSurface = ((float)this.CurrentMotherShip.altitude - this.CurrentMotherShip.heightFromTerrain < 0F) ? (float)this.CurrentMotherShip.altitude : this.CurrentMotherShip.heightFromTerrain; heightFromSurface = (heightFromSurface != -1) ? heightFromSurface : (float)this.CurrentMotherShip.altitude; fixed_height = heightFromSurface - 0.5f; transporter_target.transform.localPosition = Vector3.forward * fixed_height; // Planet Scanner planetScanner.activateScanner(zoomFactor, screen_rect); GUILayout.Label("zoomFactor: " + Math.Round(zoomFactor, 2)); zoomFactor = GUILayout.HorizontalSlider(zoomFactor, 2.01F, 100.0F); // Planet Scanner GUILayout.Label("Select a Kerbal"); // Kerbal List List <ProtoCrewMember> crewList = this.CurrentMotherShip.GetVesselCrew(); GUILayout.BeginVertical(scrollview_style); ShipToEVAscrollPosition = GUILayout.BeginScrollView(ShipToEVAscrollPosition); foreach (ProtoCrewMember cm in crewList) { if (GUILayout.Button("EVA " + cm.name)) { //TransportMode = null; transportKerbal_ShipToGround(cm); } } GUILayout.EndScrollView(); GUILayout.EndVertical(); /* */ break; case "ShipToSpace": //Debug.LogError("GUI_ShipToEVA 4 : ShipToEVASubMode=" + this.ShipToEVASubMode); GUILayout.Label("Set Required Distance from Ship in Meter"); fixed_beam_distance = Int32.Parse(GUILayout.TextField(fixed_beam_distance.ToString(), 25)); transporter_target.transform.parent = this.CurrentMotherShip.transform; // ...child to our part... transporter_target.transform.localPosition = Vector3.zero; transporter_target.transform.localEulerAngles = Vector3.zero; transporter_target.transform.localPosition = Vector3.up * fixed_beam_distance; GUILayout.Label("Select a Kerbal"); // Kerbal List List <ProtoCrewMember> crewList2 = this.CurrentMotherShip.GetVesselCrew(); GUILayout.BeginVertical(scrollview_style); ShipToEVAscrollPosition = GUILayout.BeginScrollView(ShipToEVAscrollPosition); foreach (ProtoCrewMember cm in crewList2) { if (GUILayout.Button("EVA " + cm.name)) { //TransportMode = null; transportKerbal_ShipToSpace(cm); } } GUILayout.EndScrollView(); GUILayout.EndVertical(); break; } } }