Exemple #1
0
        public BattleState(IHeroesService heroesService, GraphicResources graphicResources)
        {
            _heroesService = heroesService;
            _graphicResources = graphicResources;

            _world = new BattleWorld(heroesService, graphicResources);
            _backgroundSprite = new Sprite(graphicResources.SpriteBatch);
            _backgroundSprite.Dimension = graphicResources.Window.Dimension;
            _backgroundSprite.Texture = _graphicResources.Content.Load<Texture2D>("Backgrounds\\Forêt");
        }
Exemple #2
0
        public BU_Robot(XRobot XRobot, BattleWorld World)
            : base(World)
        {
            _xRob = XRobot;
            _world = World;
            XRobot.RegistedToWorld(this, World.Env,World.Map);

            //机器人默认行进速度1.0
            Speed = 2;

            _hp = 100;
        }
        public ClientBattleWorld(GameObject sceneRoot, IAssetProvider assetProvider, int renderFPS = 60, int logicFPS = 60)
        {
            //初始化GameObject节点
            m_sceneRoot = sceneRoot;
            //初始化配置信息
            var configLoader = ConfigDataLoader.Instance;

            m_inputConfigList = new List <ConfigDataInputDefault>(configLoader.GetAllConfigDataInputDefault().Values);
            m_inputConfigList.Sort((a, b) => { return(a.ID - b.ID); }); //从小到大,从id代表第几个玩家
            m_commandsConfig            = new List <ConfigDataCommand>(ConfigDataLoader.Instance.GetAllConfigDataCommand().Values);
            m_assetProvider             = assetProvider;                //资源加载器
            m_renderFPS                 = renderFPS;
            m_logicFPS                  = logicFPS;
            Application.targetFrameRate = m_renderFPS;
            m_gameDeltaTime             = (1000 / m_logicFPS) / 1000f;
            InitPlayerInputMapConfig(m_inputConfigList);//初始化输入配置
            // new BattleWorld
            BattleWorld.ExternalDependenceInit(LuaLoader, Debug.Log, Debug.LogWarning, Debug.LogError);
            m_battleWorld = new BattleWorld(m_commandsConfig, this);
        }
        /// <summary>
        /// 创建战场
        /// </summary>
        /// <param name="ruleId"></param>
        /// <param name="battleWorldId"></param>
        /// <returns></returns>
        static public Int64 CreateBattle(int ruleId = 0, int battleWorldId = -1)
        {
            //判断是否越界
            if (counter >= 1 << 63 - 1)
            {
                counter = 0;
            }
            counter++;
            IBattleRule rule = null;

            if (ruleId == 0)
            {
                rule = new BattleRule_TBS();
            }
            var world = new BattleWorld(battleWorldId);


            var battle = new global::Game.Battle.Battle(rule, world);

            //
            battleMap[counter] = battle;
            battle.Init();
            return(counter);
        }
Exemple #5
0
 public BattleUnit(BattleWorld World)
 {
     UnitID = Guid.NewGuid();
     _world = World;
 }