/// <summary> /// 创建一场战斗 /// </summary> /// <param name="mapRow">地图行</param> /// <param name="mapColumn">地图列</param> /// <param name="battleUnitAmount">战斗单位数量</param> /// <returns></returns> public static BattleField Create(int mapRow, int mapColumn, int battleUnitAmount) { //通过对象池获取一个战场单位 BattleField battleField = ELGame.SingletonRecyclePool <BattleField> .Get(); //创建一个地图呢 battleField.battleMap = BattleMap.Create(mapRow, mapColumn); //添加战斗单位 if (battleField.allBattleUnits == null) { battleField.allBattleUnits = new List <BattleUnit>(battleUnitAmount); } for (int i = 0; i < battleUnitAmount; i++) { //创建单个战斗单位 battleField.allBattleUnits.Add(BattleUnit.Create(i)); } return(battleField); }