Example #1
0
        public void Run(File fileObj)
        {
            if (!SelectedVolume.CheckRange())
            {
                StdOut("Selected volume is out of range.  Can;t run program.");
            }
            else
            {
                file = fileObj;

                State = ExecutionState.WAIT;

                RunBlock(fileObj);
            }
        }
Example #2
0
 public override void Update(float time)
 {
     try
     {
         base.Update(time);
         if (SelectedVolume.CheckRange())
         {
             EvaluateNextCommand();
             signalLossWarning = false;
         }
         else
         if (!signalLossWarning)
         {
             StdOut("Selected Volume has gone out of range.");
             signalLossWarning = true;
         }
     }
     catch (KOSException e)
     {
         if (ParentContext.FindClosestParentOfType <IContextRunProgram>() != null)
         {
             // Error occurs in a child of another running program
             StdOut("Error in '" + e.Program.Filename + "' on line " + e.LineNumber + ": " + e.Message);
             State = ExecutionState.DONE;
         }
         else
         {
             // Error occurs in the top level program
             StdOut("Error on line " + e.LineNumber + ": " + e.Message);
             State = ExecutionState.DONE;
         }
     }
     catch (Exception e)
     {
         // Non-kos exception! This is a bug, but no reason to kill the OS
         StdOut("Flagrant error on line " + EXECUTION_LINE);
         UnityEngine.Debug.Log("Program error");
         UnityEngine.Debug.Log(e);
         State = ExecutionState.DONE;
     }
 }