示例#1
0
    /// <summary>
    /// 初始化地图
    /// </summary>
    public void InitMap(int[][] obMapInfo, int[][] buildingMapInfo)
    {
        //// 判断是否已经设置数据
        //if (!GlobalData.FightData.IsSetData)
        //{
        //    Debug.LogError("战斗数据未设置.");
        //    return;
        //}
        Clear();
        // 清理数据
        // 加载障碍曾
        mapInfoData = obMapInfo;
        // 加载建筑层
        mapInfoBuildingData = buildingMapInfo;

        MapWidth  = mapInfoData[0].Length;
        MapHeight = mapInfoData.Length;

        //// 目标点向对方基地/炮塔前进
        //if (TargetX >= MapWidth || TargetX < 0)
        //{
        //    TargetX = MapWidth - 1;
        //}
        //if (TargetY >= MapHeight || TargetY < 0)
        //{
        //    TargetY = MapHeight - 1;
        //}
        // 初始化地图宽度
        UnitWidth = (int)SData_Constant.Single.GetDataOfID(Utils.UnitWidthId).Value;
        LoadMap.Init(mapInfoData, UnitWidth);
        // 初始化集群管理
        var loadMapPos = LoadMap.GetCenter();

        ClusterManager.Single.Init(loadMapPos.x, loadMapPos.z, MapWidth, MapHeight, UnitWidth, mapInfoData);
    }
示例#2
0
    /// <summary>
    /// 初始化地图
    /// </summary>
    private int[][] InitMapInfo()
    {
        //var mapInfoPath = Application.dataPath + Path.AltDirectorySeparatorChar + "mapinfo";
        //var mapInfoStr = Utils.LoadFileInfo(mapInfoPath);
        //var mapInfoData = DeCodeInfo(mapInfoStr);
        var mapInfoData = MapManager.Instance().GetMapInfoById(1, 1);

        LoadMap.Init(mapInfoData, UnitWidth);
        var pos = LoadMap.Single.GetCenter();

        ClusterManager.Single.Init(pos.x, pos.z, MapWidth, MapHeight, UnitWidth, mapInfoData);
        MapWidth  = mapInfoData[0].Length;
        MapHeight = mapInfoData.Length;
        return(mapInfoData);
    }
示例#3
0
 static int Init(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         LoadMap obj  = (LoadMap)ToLua.CheckObject(L, 1, typeof(LoadMap));
         int[][] arg0 = ToLua.CheckObjectArray <int[]>(L, 2);
         int     arg1 = (int)LuaDLL.luaL_checknumber(L, 3);
         obj.Init(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }