Пример #1
0
        /// <summary>
        /// constructor voor de world
        /// </summary>
        public World() {
            //vul de lijst met alle nodes
            Pathfinding.FillList();

            LoadingBay bay = CreateLoadingBay(20, 20, 20);

            //Maak objecten aan
            Pathfinding.listOfNodes[5].SetRack(CreatePalletRack(15, 1.4, 10));
            Pathfinding.listOfNodes[6].SetRack(CreatePalletRack(15, 1.4, 11.5));
            Pathfinding.listOfNodes[7].SetRack(CreatePalletRack(15, 1.4, 13));
            Pathfinding.listOfNodes[8].SetRack(CreatePalletRack(15, 1.4, 14.5));

            Pathfinding.listOfNodes[9].SetRack(CreatePalletRack(10, 1.4, 10));
            Pathfinding.listOfNodes[10].SetRack(CreatePalletRack(10, 1.4, 11.5));
            Pathfinding.listOfNodes[11].SetRack(CreatePalletRack(10, 1.4, 13));
            Pathfinding.listOfNodes[12].SetRack(CreatePalletRack(10, 1.4, 14.5));

            Pathfinding.listOfNodes[13].SetRack(CreatePalletRack(5, 1.4, 10));
            Pathfinding.listOfNodes[14].SetRack(CreatePalletRack(5, 1.4, 11.5));
            Pathfinding.listOfNodes[15].SetRack(CreatePalletRack(5, 1.4, 13));
            Pathfinding.listOfNodes[16].SetRack(CreatePalletRack(5, 1.4, 14.5));


            Truck t1 = CreateTruck(33, 0.23, 60, "1");
            Truck t2 = CreateTruck(35, 0.23, 60, "2");
            Truck t3 = CreateTruck(37, 0.23, 60, "3");

            Robot r1 = CreateRobot(28, 0.15, 13.5, 'C', t1);
            Robot r2 = CreateRobot(28, 0.15, 13.5, 'D', t2);
            Robot r3 = CreateRobot(28, 0.15, 13.5, 'E', t3);


            //Pad voor de Truck
            Pathfinding.PathTruck = Pathfinding.Listnodes("X1", "Y1", Pathfinding.listOfNodes, Pathfinding.PathTruck);

            t1.AddTask(new TruckMove(Pathfinding.StartTruck1));
            t1.AddTask(new TruckMove(Pathfinding.PathTruck));
            Pathfinding.PathTruck = new List<Node>();


            Pathfinding.PathTruck = Pathfinding.Listnodes("X2", "Y2", Pathfinding.listOfNodes, Pathfinding.PathTruck);

            t2.AddTask(new TruckMove(Pathfinding.StartTruck2));
            t2.AddTask(new TruckMove(Pathfinding.PathTruck));
            Pathfinding.PathTruck = new List<Node>();


            Pathfinding.PathTruck = Pathfinding.Listnodes("X3", "Y3", Pathfinding.listOfNodes, Pathfinding.PathTruck);

            t3.AddTask(new TruckMove(Pathfinding.StartTruck3));
            t3.AddTask(new TruckMove(Pathfinding.PathTruck));


            //Pad voor de robot
            Pathfinding.PathRobot = Pathfinding.Listnodes("A", "C4", Pathfinding.listOfNodes, Pathfinding.PathRobot);

            r1.AddTask(new RobotMove(Pathfinding.StartRobot));
            r1.AddTask(new RobotMove(Pathfinding.PathRobot));
            Pathfinding.PathRobot = new List<Node>();


            Pathfinding.PathRobot = Pathfinding.Listnodes("A", "D4", Pathfinding.listOfNodes, Pathfinding.PathRobot);

            r2.AddTask(new RobotMove(Pathfinding.StartRobot));
            r2.AddTask(new RobotMove(Pathfinding.PathRobot));
            Pathfinding.PathRobot = new List<Node>();

            Pathfinding.PathRobot = Pathfinding.Listnodes("A", "E4", Pathfinding.listOfNodes, Pathfinding.PathRobot);

            r3.AddTask(new RobotMove(Pathfinding.StartRobot));
            r3.AddTask(new RobotMove(Pathfinding.PathRobot));
        }
Пример #2
0
        // Hier worden de graph, de truck, de robots en de rekjes neergezet
        public World()
        {
            Point a = new Point(-20, 0, 0);
            Point b = new Point(-10, 0, 0);
            Point c = new Point(-10, 0, 10);
            Point d = new Point(0, 0, 10);
            Point e = new Point(10, 0, 10);
            Point f = new Point(10, 0, 0);
            Point g = new Point(10, 0, -10);
            Point h = new Point(0, 0, -10);
            Point i = new Point(-10, 0, -10);
            Point j = new Point(0, 0, 0);

            Point tA = new Point(-20, 0, -50);
            Point tB = new Point(-20, 0, 0);
            Point tC = new Point(-20, 0, 50);

            a.AddNode(b);
            b.AddNode(new List <Point>()
            {
                c, i
            });
            c.AddNode(d);
            d.AddNode(new List <Point>()
            {
                e, j
            });
            e.AddNode(f);
            f.AddNode(g);
            h.AddNode(new List <Point>()
            {
                i, j, g
            });

            tB.AddNode(new List <Point>()
            {
                tA, tB
            });

            List <Point> pointList = new List <Point>()
            {
                a, b, c, d, e, f, g, h, i, j
            };

            pointGraph = new Graph((pointList));

            truckGraph = new Graph(new List <Point>()
            {
                tA, tB, tC
            });

            Robot robot1 = CreateRobot(a);
            Robot robot2 = CreateRobot(a);
            Robot robot3 = CreateRobot(a);

            Rack rack1 = CreateRack(e);
            Rack rack2 = CreateRack(i);
            Rack rack3 = CreateRack(j);
            Rack rack4 = CreateRack(g);
            Rack rack5 = CreateRack(b);
            Rack rack6 = CreateRack(c);

            Truck t = CreateTruck(tA);

            robot1.AddTask(new RobotMove(pointGraph, rack1.point));
            robot2.AddTask(new RobotMove(pointGraph, rack2.point));
            robot3.AddTask(new RobotMove(pointGraph, rack3.point));

            int counter = 3;

            foreach (Model3D r in worldObjects)
            {
                if (r is Robot)
                {
                    ((Robot)r).AddTask(new RobotPickUp());
                    ((Robot)r).AddTask(new RobotMove(pointGraph, a));
                    ((Robot)r).AddTask(new RobotDropOff(t));
                    ((Robot)r).AddTask(new RobotPickUp());
                    ((Robot)r).AddTask(new RobotMove(pointGraph, pointList[counter]));
                    ((Robot)r).AddTask(new RobotDropOff(pointList[counter]));
                    counter++;
                    ((Robot)r).AddTask(new RobotMove(pointGraph, a));
                }
            }
            t.AddTask(new TruckMove(tB));
            t.AddTask(new TruckLoad());
            t.AddTask(new TruckMove(tC));
            t.AddTask(new TruckTeleport(tA));
            t.AddTask(new TruckMove(tB));
            t.AddTask(new TruckDump(a));
            t.AddTask(new TruckMove(tC));
        }