Beispiel #1
0
    public void Resize(int w, int h)
    {
        if (w == Width && h == Height)
        {
            return;
        }

        Size = new int2(w, h);

        if (_tiles.IsCreated)
        {
            _tiles.Dispose();
        }

        _tiles = new NativeArray <Tile>(CellCount, Allocator.Persistent);

        for (int i = 0; i < _tiles.Length; ++i)
        {
            _tiles[i] = Tile.EmptyTile;
        }

        if (_backend == null)
        {
            _backend = new SimpleMeshBackend(Width, Height, _mesh);
        }
        else
        {
            _backend.Resize(Width, Height);
        }

        _isDirty = true;
    }
Beispiel #2
0
    public void JobTest()
    {
        Mesh mesh    = new Mesh();
        var  backend = new SimpleMeshBackend(10, 10, Allocator.TempJob);
        var  tiles   = new TileData(10, 10, Allocator.TempJob);

        backend.ScheduleUpdateData(tiles);
        backend.UploadToMesh(mesh);

        Assert.AreEqual(10 * 10 * 4, mesh.vertexCount);

        tiles.Dispose();
        backend.Dispose();
    }
        void InitConsole(SimpleConsoleData data, Mesh mesh)
        {
            IConsoleBackend backend = null;

            int w = data.Width;
            int h = data.Height;

            backend = new SimpleMeshBackend(w, h, mesh);


            //switch(data.Backend)
            //{
            //    default:
            //        backend = new SimpleMeshBackend(w, h, filter.sharedMesh);
            //        break;
            //}

            _console = new SimpleConsole(
                w,
                h,
                backend,
                Allocator.Persistent);
        }