示例#1
0
        public static bool AddBlock(Ray selectionRay, AbstractBlock selectedBlock)
        {
            bool      result = false;
            Direction nearestFaceDirection = Direction.NULL;

            CollisionFace face = VoxelRaycastUtility.GetNearestCollisionFace(selectedBlock.GetCollisionFaces(), selectionRay);

            if (face is BlockCollisionFace)
            {
                nearestFaceDirection = (face as BlockCollisionFace).Facing;
            }

            if (nearestFaceDirection != Direction.NULL)
            {
                result = selectedBlock.OnAddBlock(nearestFaceDirection, new DirtBlock(BlockShape.Cube, Direction.North));
            }

            return(result);
        }