Exemple #1
0
        public AStarMultiTileMap(AStarDataMgr datas, int tileCountX, int tileCountY)
        {
            this.astarDatas = datas;
            this.tileCountX = tileCountX;
            this.tileCountY = tileCountY;

            AStarData firstData = astarDatas.getAstarData(0, 0);

            this.cellCountXPerTile = firstData.getWidthInCells();
            this.cellCountYPerTile = firstData.getHeightInCells();
            this.cellSize          = firstData.getCellSize();
            this.errorTolerate     = cellSize * ERROR_TOLERATE_RATIO;

            this.widthInCells  = tileCountX * cellCountXPerTile;
            this.heightInCells = tileCountY * cellCountYPerTile;

            checkTiles();

            loadTiles();
        }
Exemple #2
0
        public void initstring(int tileRol, int tileCol, string str)
        {
            int       tileId = makeTileId(tileRol, tileCol);
            AStarData data;

            if (astarDatas.TryGetValue(tileId, out data))
            {
                return;
            }
            string[] strs = str.Split(new char[] { '\n', '\r' });

            AStarData astarData = AStarData.Parse(strs);

            astarDatas.Add(tileId, astarData);

            if (_nullTile == null)
            {
                _nullTile = new AStarDataNull(astarData.getWidthInCells(), astarData.getHeightInCells(), astarData.getCellSize());
            }
        }