示例#1
0
        private static void CreateRobots()
        {
            Graph graphBackup = null;

            if (Robots.MainRobot != null)
            {
                graphBackup = Robots.MainRobot.Graph;
            }

            Robots.MainRobot?.DeInit();

            if (!Simulation)
            {
                MainRobot = new RobotReel(IDRobot.GrosRobot, Board.RecMove);
            }
            else
            {
                MainRobot = new RobotSimu(IDRobot.GrosRobot);
            }

            if (Config.CurrentConfig.IsMiniRobot)
            {
                MainRobot.SetDimensions(220, 160, 160, 143.8, 346);
            }
            else
            {
                MainRobot.SetDimensions(335, 135, 130.5, 295, 420);
            }

            MainRobot.PositionChanged += MainRobot_PositionChanged;

            DicRobots = new Dictionary <IDRobot, Robot>();
            DicRobots.Add(IDRobot.GrosRobot, MainRobot);

            MainRobot.Init();
            if (graphBackup != null)
            {
                Robots.MainRobot.Graph = graphBackup;
            }
            MainRobot.SetSpeedFast();
        }
示例#2
0
文件: Robots.cs 项目: KiwiJaune/GoBot
        private static void CreerRobots()
        {
            Graph graphGros = null;
            if (Robots.GrosRobot != null && Robots.GrosRobot.Graph != null)
                graphGros = Robots.GrosRobot.Graph;

            if (!Simulation)
            {
                RobotReel grosRobot = new RobotReel(IDRobot.GrosRobot, Carte.RecMove);
                grosRobot.Connexion = Connexions.ConnexionMove;
                GrosRobot = grosRobot;
            }
            else
            {
                if (GrosRobot != null)
                    ((RobotReel)GrosRobot).Delete();
                GrosRobot = new RobotSimu(IDRobot.GrosRobot);
            }

            DicRobots = new Dictionary<IDRobot, Robot>();
            DicRobots.Add(IDRobot.GrosRobot, GrosRobot);

            GrosRobot.Largeur = 320;
            GrosRobot.Longueur = 300;
            GrosRobot.Nom = "Gros robot";
            GrosRobot.Init();
            if (graphGros != null)
                Robots.GrosRobot.Graph = graphGros;

            GrosRobot.VitesseDeplacement = Config.CurrentConfig.GRVitesseLigneRapide;
            GrosRobot.AccelerationDebutDeplacement = Config.CurrentConfig.GRAccelerationLigneRapide;
            GrosRobot.AccelerationFinDeplacement = Config.CurrentConfig.GRAccelerationFinLigneRapide;
            GrosRobot.VitessePivot = Config.CurrentConfig.GRVitessePivotRapide;
            GrosRobot.AccelerationPivot = Config.CurrentConfig.GRAccelerationPivotRapide;
        }