Exemplo n.º 1
0
 private void ObserveOverallState(int timeMs)
 {
     EmitterCart.Observe(_master);
     FocusCart.Observe(_master);
     TestEmitter.Observe(_master);
     TestFocus.Observe(_master, timeMs);
     TestLaser.Observe(_master, timeMs);
     TestFieldGenerator.Observe(_master, timeMs);
     TestTemperature.ObserveUpperBound(_master, timeMs);
 }
 /// <summary>
 /// Called before the simulation is added to the  main tree
 /// </summary>
 public void Setup()
 {
     EmitterCart = GetNode <Cart>("EmitterCart");
     EmitterCart.Setup();
     Emitter = GetNode <EmitterParticles>("EmitterCart/EmitterParticles");
     Emitter.Setup();
     FocusCart = GetNode <Cart>("FocusCart");
     FocusCart.Setup();
     Central = GetNode <CentralParticles>("CentralParticles");
     Central.Setup();
     Discharge       = GetNode <Particles>("DischargeParticles");
     Laser           = GetNode <Particles>("LaserParticles");
     EmergencyActors = GetNode <EmergencyActors>("EmergencyActors");
     EmergencyActors.Setup();
 }
        private void UpdateEmitter(MassTestChamber master, int deltaTime)
        {
            int direction = master.SimulationInput.PollInteger(MassTestChamber.EmitterMotorKey);

            if (direction != 0)
            {
                EmitterCart.Drive(direction > 0, deltaTime);
            }
            bool emitting = master.SimulationInput.PollBoolean(MassTestChamber.EmitterKey);

            if (emitting)
            {
                bool field      = master.SimulationInput.PollBoolean(MassTestChamber.FieldGeneratorKey);
                bool focusOn    = master.SimulationInput.PollBoolean(MassTestChamber.FocusKey);
                bool focusValid = FocusCart.FrontPositionReached && focusOn;
                Emitter.ShowAsActiveWith(EmitterCart, field, focusValid);
            }
            else
            {
                Emitter.ShowAsOff(EmitterCart);
            }
            master.SimulationOutput.SetValue(MassTestChamber.EmitterFrontKey, EmitterCart.FrontPositionReached);
            master.SimulationOutput.SetValue(MassTestChamber.EmitterBackKey, EmitterCart.BackPositionReached);
        }