Ejemplo n.º 1
0
 public World()
 {
     robot1      = CreateRobot("r1", 0, 0.301, 0, 50);
     robot2      = CreateRobot("r2", 0, 0.301, -4, 100);
     robot3      = CreateRobot("r3", 0, 0.301, -8, 150);
     robot4      = CreateRobot("r4", 0, 0.301, -12, 200);
     thunderhawk = CreateTH(-150, 0.001, -21);
     MakeNodes(23 /* + 64*/);
     shelf1    = CreateShelf(-300, 1.401, -300);
     shelf2    = CreateShelf(-300, 1.401, -300);
     shelf3    = CreateShelf(-300, 1.401, -300);
     shelf4    = CreateShelf(-300, 1.401, -300);
     shelf5    = CreateShelf(-300, 1.401, -300);
     shelf6    = CreateShelf(-300, 1.401, -300);
     shelf7    = CreateShelf(-300, 1.401, -300);
     shelf8    = CreateShelf(-300, 1.401, -300);
     shelf9    = CreateShelf(-300, 1.401, -300);
     shelf10   = CreateShelf(-300, 1.401, -300);
     shelf11   = CreateShelf(-300, 1.401, -300);
     shelf12   = CreateShelf(-300, 1.401, -300);
     shelf13   = CreateShelf(-300, 1.401, -300);
     shelf14   = CreateShelf(-300, 1.401, -300);
     shelf15   = CreateShelf(-300, 1.401, -300);
     shelf16   = CreateShelf(-300, 1.401, -300);
     shelf17   = CreateShelf(-300, 1.401, -300);
     shelf18   = CreateShelf(-300, 1.401, -300);
     shelf19   = CreateShelf(-300, 1.401, -300);
     shelf20   = CreateShelf(-300, 1.401, -300);
     graph     = new Graph();
     graph     = Graphy();
     taskClass = new Tasks(this, this.worldObjects.ToList());
 }
Ejemplo n.º 2
0
        private ThunderHawk CreateTH(double x, double y, double z)
        {
            ThunderHawk t = new ThunderHawk(x, y, z, 0, (90 * Math.PI / 180), 0);

            worldObjects.Add(t);
            return(t);
        }
Ejemplo n.º 3
0
        public void Update()
        {
            ThunderHawk thunderhawk = (ThunderHawk)worldObjects[4];
            Robot       robot1      = (Robot)worldObjects[0];
            Robot       robot2      = (Robot)worldObjects[1];
            Robot       robot3      = (Robot)worldObjects[2];
            Robot       robot4      = (Robot)worldObjects[3];
            Shelf       shelf1      = (Shelf)worldObjects[28 + (4 * cycles)];
            Shelf       shelf2      = (Shelf)worldObjects[29 + (4 * cycles)];
            Shelf       shelf3      = (Shelf)worldObjects[30 + (4 * cycles)];
            Shelf       shelf4      = (Shelf)worldObjects[31 + (4 * cycles)];

            if (thunderhawk.thunderhawkHere == true)
            {
                robot1.ChangeThunderhawkHere(true);
                robot2.ChangeThunderhawkHere(true);
                robot3.ChangeThunderhawkHere(true);
                robot4.ChangeThunderhawkHere(true);
            }

            if (robot1.robotReady == true)
            {
                MoveShelf(robot1, shelf1, robot1.x, robot1.y, robot1.z);
                robot1.ChangeShelf(shelf1);
                robot1.ChangeRobotReady(false);
                robot1.ChangeRobotLoaded(true);
                ReadySetGo++;
            }

            if (robot2.robotReady == true)
            {
                MoveShelf(robot2, shelf2, robot2.x, robot2.y, robot2.z);
                robot2.ChangeShelf(shelf2);
                robot2.ChangeRobotReady(false);
                robot2.ChangeRobotLoaded(true);
                ReadySetGo++;
            }

            if (robot3.robotReady == true)
            {
                MoveShelf(robot3, shelf3, robot3.x, robot3.y, robot3.z);
                robot3.ChangeShelf(shelf3);
                robot3.ChangeRobotReady(false);
                robot3.ChangeRobotLoaded(true);
                ReadySetGo++;
            }

            if (robot4.robotReady == true)
            {
                MoveShelf(robot4, shelf4, robot4.x, robot4.y, robot4.z);
                robot4.ChangeShelf(shelf4);
                robot4.ChangeRobotReady(false);
                robot4.ChangeRobotLoaded(true);
                ReadySetGo++;
            }

            if (robot1.robotDropped == true)
            {
                world.RobotGoesBack(robot1, robot1.target, "A");
            }

            if (robot2.robotDropped == true)
            {
                world.RobotGoesBack(robot2, robot2.target, "null1");
            }

            if (robot3.robotDropped == true)
            {
                world.RobotGoesBack(robot3, robot3.target, "null2");
            }

            if (robot4.robotDropped == true)
            {
                world.RobotGoesBack(robot4, robot4.target, "null3");
            }

            if (ReadySetGo == 4)
            {
                thunderhawk.ChangeThunderhawkEmpty(true);
                robot1.ChangeRobotDone(false);
                robot2.ChangeRobotDone(false);
                robot3.ChangeRobotDone(false);
                robot4.ChangeRobotDone(false);
                ReadySetGo++;
                world.THHere();
            }

            if (robot1.robotReset == true && robot2.robotReset == true && robot3.robotReset == true && robot4.robotReset == true)
            {
                ReadySetGo = 0;
                cycles++;
                robot1.RESET();
                robot2.RESET();
                robot3.RESET();
                robot4.RESET();
                thunderhawk.RESET();
            }
        }