Beispiel #1
0
        private void checkTiles()
        {
            for (int h = 0; h < tileCountY; ++h)
            {
                for (int w = 0; w < tileCountX; ++w)
                {
                    AStarData astarData = astarDatas.getAstarData(h, w);;
                    if (astarData == null)
                    {
                        throw new ApplicationException("tile invalid:" + h + "," + w);
                    }

                    if (astarData.getWidthInCells() != cellCountXPerTile ||
                        astarData.getHeightInCells() != cellCountYPerTile)
                    {
                        throw new ApplicationException("tile size invalid:" + h + "," + w);
                    }
                }
            }
        }
Beispiel #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());
            }
        }
Beispiel #3
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();
        }