Example #1
0
 private void CollectResults()
 {
     if (!IsExecutable ||
         TestController.BatteryTest.Overcharged ||
         TestController.TankTest.Overcharged ||
         TestController.SafeguardTest.WrongTime ||
         TestController.AlarmLightTest.ReportedEarlyActivation ||
         TestController.AlarmLightTest.ReportedEarlyDeactivation ||
         Simulation.SystemState == EmergencySystem.State.Failure)
     {
         PaperLog.Append("[b]Result: 0 Stars[/b]\n");
         _openedLesson.SetAndSaveStars(0);
     }
     else if (TestController.BatteryTest.WrongTime ||
              TestController.TankTest.WrongTime ||
              TestController.StageRechargeTimedOut)
     {
         PaperLog.Append("[b]Result: 1 Star[/b]\n");
         _openedLesson.SetAndSaveStars(1);
     }
     else
     {
         PaperLog.Append("No problems were noted in the emergency protocol.\n");
         PaperLog.Append("[b]Result: 3 Stars![/b]\n");
         _openedLesson.SetAndSaveStars(3);
     }
 }
Example #2
0
 /// <summary>
 /// Initializes the whole test viewer. Called before the node is added to the tree by the lesson controller.
 /// </summary>
 public override void InitialiseWith(IMainNode mainNode, ILessonEntity openedLesson)
 {
     _openedLesson    = openedLesson;
     Simulation       = GetNode <MassTestChamber>(_testChamberPath);
     SimulationMaster = DiagramSimulationLoader.LoadTemp(openedLesson, Simulation);
     if (SimulationMaster != null)
     {
         Simulation.InitialiseWith(mainNode, openedLesson);
         IsExecutable = SimulationMaster.IsProgramSimulationValid();
     }
     else
     {
         IsExecutable = false;
     }
     PaperLog = GetNode <PaperLog>("PaperLog");
     PaperLog.Setup();
     TestController = new TestController(this);
     TestController.Setup();
 }
Example #3
0
        public override void _Process(float delta)
        {
            int simulationSteps = LookupTargetSimulationCycles();

            for (int i = 0; i < simulationSteps; i++)
            {
                switch (_stage)
                {
                case Stages.Startup:
                    if (!IsExecutable)
                    {
                        PaperLog.AppendError("SFC is invalid!\nAborting tests.\n");
                        _stage = Stages.CollectResults;
                    }
                    else
                    {
                        _stage = Stages.Test;
                    }
                    break;

                case Stages.Test:
                    TestController.TestStage();
                    if (TestController.Stage == EmergencySystemTestStages.Stages.Done)
                    {
                        _stage = Stages.CollectResults;
                    }
                    break;

                case Stages.CollectResults:
                    CollectResults();
                    _stage = Stages.Done;
                    break;

                case Stages.Done:
                    GetNode <Viewport>("ViewportContainer/Viewport").RenderTargetUpdateMode = Viewport.UpdateMode.Once;
                    _stage = Stages.Idle;
                    break;
                }
            }
        }