Esempio n. 1
0
        /********************************** END OF PROPERTIES **********************************/

        public World()
        {
            this._simulationTask = null;

            foreach (Vector3 pos in Constants.StoragePositions)
            {
                CreateStoragePlot(pos.X, pos.Y, pos.Z, 0, 0, 0, Constants.StoragePlotLength, Constants.StoragePlotWidth);
            }

            _robotPathfindingGraph = new Graph(Constants.GraphEdges);
            _truckPathfindingGraph = new Graph(
                new Edge[]
            {
                new Edge(Constants.TruckSpawn, Constants.TruckStop),
                new Edge(Constants.TruckStop, Constants.TruckDespawn)
            }
                );

            _robotPathfindingGraph.IntegrateVerticesToNearestEdge(
                new List <Vector3>()
            {
                Constants.RobotEnterTruck,
                Constants.RobotExitTruck
            },
                Constants.LaneWidth);

            _worldObjects.Add(new GraphDisplay(this, _robotPathfindingGraph));

            foreach (Vector3 s in Constants.RobotSpawns)
            {
                CreateRobot(s.X, s.Y, s.Z);
            }
        }
Esempio n. 2
0
 public bool RunTask(SimulationTask <World> task)
 {
     if (this._simulationTask != null && !this._simulationTask.IsFinished)
     {
         return(false);
     }
     this._simulationTask = task;
     return(true);
 }
Esempio n. 3
0
        public bool Tick(int tick)
        {
            // Run current simulation task if any is available
            if (this._simulationTask != null && this._simulationTask.Tick())
            {
                this._simulationTask = null;
            }

            foreach (Entity o in _worldObjects)
            {
                o.Tick(tick);
            }

            return(true);
        }
Esempio n. 4
0
 public void AssignTask(SimulationTask <Robot> task)
 => _tasks.Enqueue(task);