private void DrawLSNamingWindow(int windowID) { _currentLaunchSiteName = GUI.TextField(new Rect(10, 25, 280, 22), _currentLaunchSiteName); GUI.backgroundColor = Color.green; if (GUI.Button(new Rect(10, 55, 80, 22), "Done")) { if (_currentLaunchSiteName.Trim().Length > 0 && (_currentLaunchSiteName != "LaunchPad" && _currentLaunchSiteName != "Runway")) { _currentSelectedObject.MakeLaunchSite(true, _currentLaunchSiteName); _lsNameVisible = false; } else { Extensions.LogError("Invalid Launch Site name."); } } GUI.backgroundColor = Color.red; if (GUI.Button(new Rect(100, 55, 80, 22), "Cancel")) { _currentLaunchSiteName = ""; _lsNameVisible = false; } GUI.DragWindow(new Rect(0, 0, 10000, 10000)); }
public bool MakeLaunchSite(bool isLaunchSite, string name = "") { if (!isLaunchSite) { LaunchSiteName = ""; return(true); } // Still require the object to contain a spawn point. // TODO: Add support for multiple spawn points. if (StaticGameObject.transform.Cast <Transform>().Any(t => t.name.EndsWith("_spawn"))) { LaunchSiteName = name; return(true); } Extensions.LogError("Unable to find the launch spawning transform."); return(false); }