Ejemplo n.º 1
0
        //---------------------------------------------------------------------
        // unity3d top 视图,坐标原点Terrain左下,而png原点在左上,应用层将坐标转换好传进来
        public void load(IEbPixelLoader pixel_loader, float xmin_world, float zmin_world,
            float width_world, float height_world)
        {
            mPixelLoader = pixel_loader;

            WidthWorld = width_world;
            HeightWorld = height_world;
            XMinWorld = xmin_world;
            ZMinWorld = zmin_world;
            WidthGrid = mPixelLoader.width;
            HeightGrid = mPixelLoader.height;

            mGridRegions = new EbGridRegion[WidthGrid, HeightGrid];
            mPixelNav = new EbPixelNav((uint)(WidthGrid * HeightGrid));

            mPixelNav.blockStart(mPixelLoader.width, mPixelLoader.height);
            mPixelLoader.foreachPixel(
            (bool is_block, int w, int h) =>
            {
                if (is_block)
                {
                    mGridRegions[w, h] = null;
                    mPixelNav.setBlock(w, h);
                }
                else
                {
                    mGridRegions[w, h] = new EbGridRegion(mEntityMgr);
                }
            }
            );
            mPixelNav.blockEnd();
        }
Ejemplo n.º 2
0
        //---------------------------------------------------------------------
        // unity3d top 视图,坐标原点Terrain左下,而png原点在左上,应用层将坐标转换好传进来
        public void load(IEbPixelLoader pixel_loader, float xmin_world, float zmin_world,
                         float width_world, float height_world)
        {
            mPixelLoader = pixel_loader;

            WidthWorld  = width_world;
            HeightWorld = height_world;
            XMinWorld   = xmin_world;
            ZMinWorld   = zmin_world;
            WidthGrid   = mPixelLoader.width;
            HeightGrid  = mPixelLoader.height;

            mGridRegions = new EbGridRegion[WidthGrid, HeightGrid];
            mPixelNav    = new EbPixelNav((uint)(WidthGrid * HeightGrid));

            mPixelNav.blockStart(mPixelLoader.width, mPixelLoader.height);
            mPixelLoader.foreachPixel(
                (bool is_block, int w, int h) =>
            {
                if (is_block)
                {
                    mGridRegions[w, h] = null;
                    mPixelNav.setBlock(w, h);
                }
                else
                {
                    mGridRegions[w, h] = new EbGridRegion(mEntityMgr);
                }
            }
                );
            mPixelNav.blockEnd();
        }