Ejemplo n.º 1
0
        private Dictionary<Guid, BattleUnit> _units = new Dictionary<Guid, BattleUnit>(); //所有物件集合

        #endregion Fields

        #region Constructors

        public BattleWorld(XRobot[] Robots,BattleMap Map,BattleCfg Cfg,BattleEnv Env)
        {
            //_robs = new BU_Robot[Robots.Length];
            foreach (XRobot bot in Robots)
            {
                //添加机器人到战场
                AddUnit(new BU_Robot(bot, this));
            }

            _matrix = new TimeMatrix(this);
            this.Config = Cfg;
            this.Map = Map;
            this.Env = Env;
        }
Ejemplo n.º 2
0
Archivo: Form1.cs Proyecto: eijix/test
        private void button1_Click(object sender, EventArgs e)
        {
            MyRobot.EijiBot bot = new EijiBot();
            BattleMap map = new BattleMap(400,300);
            BattleCfg cfg = new BattleCfg();
            cfg.UnitPixel = 2;
            cfg.FramsPerS = 100;
            cfg.RotateUnitTimeMs = 1;
            cfg.MoveUnitTimeMs = 2;    //10ms 一个时间单位
            cfg.CtlTickStep = 5;    //控制帧间隔,间隔 = (1000/FramsPerS) * CtlTickStep
            BattleEnv env = new BattleEnv();
            BattleWorld bw = new BattleWorld(new XRobot[] { bot}, map, cfg, env);

            bw.StartBattle();
            _battleGUIFrm.Start(bw);
            _battleGUIFrm.Show();
        }