Exemplo n.º 1
0
 public override bool AfterInit()
 {
     Agent.Send(instruction: Supervisor.Instruction.PopOrder.Create(message: "Pop", target: Agent.Context.Self), waitFor: 1);
     Agent.Send(instruction: EndSimulation.Create(message: true, target: Agent.Context.Self), waitFor: _simulationEnds);
     Agent.Send(instruction: Supervisor.Instruction.SystemCheck.Create(message: "CheckForOrders", target: Agent.Context.Self), waitFor: 1);
     Agent.DebugMessage(msg: "Agent-System ready for Work");
     return(true);
 }
Exemplo n.º 2
0
    public override void OnEvent(EndSimulation evnt)
    {
        if (!evnt.FromSelf)
        {
            ConnectionVoxelContainer.RemoveAllConnections();
            CollisionVoxelContainer.RemoveAllGos();

            foreach (GameObject go in GlobalReferences.FrozenParts.Values)
            {
                Part part = go.GetComponent <Part>();

                CollisionVoxelContainer.StoreGameObject(go);

                foreach (int i in part.ActiveConnections)
                {
                    ConnectionVoxelContainer.StoreConnection(part.Connections[i]);
                }
            }
        }
        PlacementReferences.Scanning = true;
    }
Exemplo n.º 3
0
        private void TerminateSimulation(string reason)
        {
            IStatistics stats = new Statistics(time.Secs, (float)coverage, RobotVacuum.Vacuum.Algorithm.Algorithm);

            dead.DeregisterHandler(BatteryDead); //Ensures that the battery dead observer does not have two instances of the BatteryDead handler method.

            IsRunning    = false;
            time.Enabled = false; //disables the timer.
            //Stops the timer thread.
            EndSimulation end;



            this.Dispatcher.Invoke(() =>
            {
                end = new EndSimulation(reason, stats);
                end.Show();
                this.Close();
            }); //Force this code to run in the UI thread.

            // room.Vacuum.AbortThread();
        }