Exemplo n.º 1
0
        public static void LoadPaths()
        {
            ConfigNode config;

            try
            {
                config = ConfigNode.Load(KerbCamGlobals.AssemblyPath + "/kerbcam-paths.cfg");
            }
            catch (NullReferenceException)
            {
                Debug.LogWarning("KerbCam encountered NRE while loading kerbcam-paths.cfg - file corrupted?");
                return;
            }
            if (config == null)
            {
                Debug.LogWarning(
                    "KerbCam could not load paths. This is okay if " +
                    "they have not been saved yet.");
                return;
            }
            var newPaths = new List <SimpleCamPath>();

            foreach (var pathNode in config.GetNodes("PATH"))
            {
                var path = new SimpleCamPath();
                path.Load(pathNode);
                newPaths.Add(path);
            }
            paths        = newPaths;
            SelectedPath = null;
        }
Exemplo n.º 2
0
        public static SimpleCamPath NewPath()
        {
            numCreatedPaths++;
            var newPath = new SimpleCamPath("Path #" + numCreatedPaths);

            paths.Add(newPath);
            return(newPath);
        }
Exemplo n.º 3
0
 public static void Stop()
 {
     camControl.StopControlling();
     if (SelectedPath != null)
     {
         SelectedPath.StopDrawing();
         SelectedPath = null;
     }
     MainWindow.Instance.HideWindow();
 }
Exemplo n.º 4
0
        public static void RemovePathAt(int index)
        {
            var path = paths[index];

            if (path == selectedPath)
            {
                SelectedPath = null;
            }
            paths.RemoveAt(index);
            path.Destroy();
        }
Exemplo n.º 5
0
 internal static PathRunner Create(SimpleCamPath path)
 {
     GameObject ownerObject = new GameObject("KerbCam.PathRunner");
     UnityEngine.Object.DontDestroyOnLoad(ownerObject);
     PathRunner runner = ownerObject.AddComponent<PathRunner>();
     runner.path = path;
     runner.ownerObject = ownerObject;
     // Don't use GUI layout, just input events and frame updates.
     runner.useGUILayout = false;
     runner.enabled = false;
     return runner;
 }
Exemplo n.º 6
0
 public static void Stop()
 {
     if (!initialized) {
         return;
     }
     camControl.StopControlling();
     if (SelectedPath != null) {
         SelectedPath.StopDrawing();
         SelectedPath = null;
     }
     mainWindow.HideWindow();
 }
Exemplo n.º 7
0
 public static void RemovePathAt(int index)
 {
     var path = paths[index];
     if (path == selectedPath) {
         SelectedPath = null;
     }
     paths.RemoveAt(index);
     path.Destroy();
 }
Exemplo n.º 8
0
 public static SimpleCamPath NewPath()
 {
     numCreatedPaths++;
     var newPath = new SimpleCamPath("Path #" + numCreatedPaths);
     paths.Add(newPath);
     return newPath;
 }
Exemplo n.º 9
0
 public static void LoadPaths()
 {
     ConfigNode config;
     config = ConfigNode.Load("kerbcam-paths.cfg");
     if (config == null) {
         Debug.LogWarning(
             "KerbCam could not load paths. This is okay if " +
             "they have not been saved yet.");
         return;
     }
     var newPaths = new List<SimpleCamPath>();
     foreach (var pathNode in config.GetNodes("PATH")) {
         var path = new SimpleCamPath();
         path.Load(pathNode);
         newPaths.Add(path);
     }
     paths = newPaths;
     SelectedPath = null;
 }
Exemplo n.º 10
0
 public static void LoadPaths()
 {
     ConfigNode config;
     try {
         config = ConfigNode.Load("kerbcam-paths.cfg");
     } catch (NullReferenceException) {
         Debug.LogWarning("KerbCam encountered NRE while loading kerbcam-paths.cfg - file corrupted?");
         return;
     }
     if (config == null) {
         Debug.LogWarning(
             "KerbCam could not load paths. This is okay if " +
             "they have not been saved yet.");
         return;
     }
     var newPaths = new List<SimpleCamPath>();
     foreach (var pathNode in config.GetNodes("PATH")) {
         var path = new SimpleCamPath();
         path.Load(pathNode);
         newPaths.Add(path);
     }
     paths = newPaths;
     SelectedPath = null;
 }