private void SMakeMesh()
        {
            if (ChunkMesh != null)
            {
                if (_meshCollider != null)
                {
                    _meshCollider.UpdateCollider(transform, ChunkMesh);
                }
                else
                {
                    _meshCollider = new MeshCollider(transform, ChunkMesh._vertices, ChunkMesh._indices);
                }

                if (_meshRender != null)
                {
                    _meshRender.UpdateMeshRender(ChunkMesh);
                }
                else
                {
                    _meshRender = new ChunkMeshRender(transform, ChunkMesh, AssetsManager.GetShader("TerrainDefault"), AssetsManager.GetTexture("TileAtlas"));

                    _meshRender.ViewBoxWitdh  = 10;
                    _meshRender.ViewBoxHeight = 1000;
                }
            }

            if (WaterMesh != null)
            {
                if (_waterMeshRender != null)
                {
                    //_meshRender.UpdateMeshRender(ChunkMesh);
                }
                else
                {
                    _waterMeshRender = new WaterMeshRender(transform, WaterMesh, AssetsManager.GetShader("Water"), AssetsManager.GetTexture("Water"), AssetsManager.GetTexture("Water2"));
                    _waterMeshRender.Transparency = true;

                    _waterMeshRender.ViewBoxWitdh  = 10;
                    _waterMeshRender.ViewBoxHeight = 1000;
                }
            }

            for (int i = 0; i < _trees.Count; i++)
            {
                _trees[i].OnDestroy();
            }

            _trees.Clear();

            for (int x = 0; x < MidleWorld.ChunkSize; x++)
            {
                for (int z = 0; z < MidleWorld.ChunkSize; z++)
                {
                    if (blocks[x, z].treeType != TreeType.none)
                    {
                        _trees.Add(new Tree(new Vector3(blocks[x, z].x, blocks[x, z].height, blocks[x, z].z), blocks[x, z].treeType));
                    }
                }
            }
        }
        public Tree(Vector3 position, TreeType treeType)
        {
            HP    = 100;
            MaxHP = 100;

            transform = new Transform();

            System.Random rand = new System.Random();

            float a = (float)rand.NextDouble();
            float b = (float)rand.NextDouble();

            float ChunkSeed = position.X * a + position.Z * b;

            transform.Position = position;
            transform.Rotation = new Quaternion(MathHelper.DegreesToRadians((float)new System.Random((int)ChunkSeed).Next(-10, 10)), MathHelper.DegreesToRadians((float)new System.Random((int)ChunkSeed).Next(0, 90)), MathHelper.DegreesToRadians((float)new System.Random((int)ChunkSeed).Next(-10, 10)));

            float size = ProjectEvlly.src.Utility.Random.Range(1.5f, 2f, (int)ChunkSeed);

            transform.Size = new Vector3(1, 1, 1);

            switch (treeType)
            {
            case TreeType.Oak:
                _meshRender = new MeshRender(transform, AssetsManager.GetMesh("oak"), AssetsManager.GetShader("Default"), AssetsManager.GetTexture("SpritesTreeHigt"));
                break;

            case TreeType.Pine:
                _meshRender = new MeshRender(transform, AssetsManager.GetMesh("Pine01"), AssetsManager.GetShader("Default"), AssetsManager.GetTexture("SpritesTreeHigt"));
                break;

            case TreeType.PineSnow:
                _meshRender = new MeshRender(transform, AssetsManager.GetMesh("Pine01"), AssetsManager.GetShader("Default"), AssetsManager.GetTexture("SpritesTreeHigt_Snow"));
                break;
            }

            _meshRender.ViewBoxWitdh  = 3;
            _meshRender.ViewBoxHeight = 5;

            //_meshRender.Transparency = true;
            _meshRender._cullType = OpenTK.Graphics.OpenGL.CullFaceMode.FrontAndBack;

            _boxCollider = new BoxCollider(transform, new Vector3(0.7f, 5, 0.7f));
        }