Пример #1
0
        /// <summary>
        /// 设置泥块
        /// </summary>
        /// <param name="newClod">新的泥块</param>
        /// <param name="x">X</param>
        /// <param name="y">Y</param>
        /// <param name="z">Z</param>
        /// <returns>是否可以设置</returns>
        public bool setClod(Clod newClod, int x, int y, int z)
        {
            //计算岛屿和方块在岛屿的坐标
            int ix = (x) >> 4;
            int iz = (z) >> 4;
            int cx = (x) & 15;
            int cy = (y) & 127;
            int cz = (z) & 15;

            //获取岛屿指针
            Island island = getIsland(ix, iz);

            if (island != null)
            {
                //超出限制当然要踢出!当然这不可能!
                if (cx < 0 || cx >= 16 || cy < 0 || cy >= 128 || cz < 0 || cz >= 16)
                {
                    return(false);
                }

                //设置。。
                island.clods[cx, cy, cz] = newClod;

                //更新网格,貌似要删掉?
                island.createMesh();

                //更新岛屿网格
                if (cx == 0)
                {
                    getIsland(ix - 1, iz).createMesh();
                }
                else if (cx == 15)
                {
                    getIsland(ix + 1, iz).createMesh();
                }
                if (cz == 0)
                {
                    getIsland(ix, iz - 1).createMesh();
                }
                else if (cz == 15)
                {
                    getIsland(ix, iz + 1).createMesh();
                }

                return(true);
            }

            return(false);
        }
Пример #2
0
 public override void createMesh(Island island, int x, int y, int z)
 {
     island.setTexture("Soil");
     island.addBoxToMesh(x, y, z, 1, 1, 1);
 }
Пример #3
0
 public override void createMesh(Island island, int x, int y, int z)
 {
     island.addBoxToMesh(x, y, z, 1, 1, 1);
 }
Пример #4
0
 /// <summary>
 /// 泥块的渲染函数(为何不是Create?写gl习惯了。。)
 /// </summary>
 /// <param name="island">岛屿指针</param>
 /// <param name="x">坐标X</param>
 /// <param name="y">坐标Y</param>
 /// <param name="z">坐标Z</param>
 public virtual void createMesh(Island island, int x, int y, int z)
 {
 }