void ShootRay(Vector3 mousePos)
    {
        Vector3 from, clickWorldPoint, normalDir;

        GeometryTool.GetShootingRay(mousePos, out from, out clickWorldPoint, out normalDir);

        //debug用
        voxelBuilder.SetClickPointOnRay(clickWorldPoint);
        voxelBuilder.SetClickNormalDir(normalDir);

        int nowFloor, nowY, nowX;
        //mahjongMap的平面朝向是固定的,所以不作座標變換
        bool isHit = voxelBuilder.DoClick(from, normalDir, out nowFloor, out nowY, out nowX);

        if (!isHit)
        {
            return;
        }

        var funptr = DoWhat();

        for (var y = 0; y < voxelBuilder.GetAddCountY(); ++y)
        {
            for (var x = 0; x < voxelBuilder.GetAddCountX(); ++x)
            {
                var node = voxelBuilder.GetVoxel(nowFloor, nowY + 2 * y, nowX + 2 * x);
                if (node == null)
                {
                    continue;
                }

                voxelBuilder.DoOperation(node, funptr);
            }
        }
    }
示例#2
0
 Voxel GetVoxel(int floor, int y, int x)
 {
     return(voxelBuilder.GetVoxel(floor, y, x));
 }