コード例 #1
0
        static public RobotQuestMap GetQuest(Window w, string name)
        {
            var map = MapCreator.GetUniversalMap(w, GetMapParams(name));

            map.DrawGrid();
            var lay = LayoutsFactory.GetLayout(LayoutType.SingleZone, w.Content);

            lay.Attach(map, 0);


            RobotQuestMap qMap = null;
            RobotMap      rMap;
            SimpleRobot   rBot;
            Coordinate    c;

            switch (name)
            {
            case "task1":
                rMap = new RobotMap(map);
                rMap.SetExit(ExitPlacement.Fixed);
                c = rMap.SetRobot(RobotPlacement.Random);
                rMap.PlaceObstacles(ObstaclesFormation.SeparatedBlocks);
                rBot = new SimpleRobot(map, rMap, c);
                qMap = new RobotQuestMap(map, rMap, rBot);
                break;

            case "task2":
                rMap = new RobotMap(map);
                rMap.SetExit(ExitPlacement.RandomCorner);
                c = rMap.SetRobot(RobotPlacement.Random);
                rMap.PlaceObstacles(ObstaclesFormation.SeparatedBlocks);
                rBot = new SimpleRobot(map, rMap, c);
                qMap = new RobotQuestMap(map, rMap, rBot);
                break;
            }
            return(qMap);
        }
コード例 #2
0
 public RobotQuestMap(UniversalMap_Wpf wMap, RobotMap _rMap, SimpleRobot _rBot)
 {
     rBot = _rBot;
     rMap = _rMap;
     wMap.Keyboard.SetSingleKeyEventHandler(Launcher);
 }