Example #1
0
        private void handleFinishDragging(PlayerAction.Action action)
        {
            PlayerAction.FinishDragging finishDragClick = (PlayerAction.FinishDragging)action;
            Ray     finishDragRay   = finishDragClick.getRay();
            Vector3?finishDragBlock = world.getBlockAlongRay(finishDragRay);

            if (finishDragBlock.HasValue)
            {
                BlockLoc currentFinishBlock = new BlockLoc((int)((Vector3)finishDragBlock).X, (int)((Vector3)finishDragBlock).Y, (int)((Vector3)finishDragBlock).Z);
                IEnumerable <BlockLoc> draggedBlocks;
                if (finishDragClick.getDragType() == PlayerAction.Dragging.DragType.excavate)
                {
                    draggedBlocks = world.GetBlocksBoundBy(player.getFirstBlockInDrag(), currentFinishBlock);
                }
                else
                {
                    draggedBlocks = world.getSurfaceBlocksBoundBy(player.getFirstBlockInDrag(), currentFinishBlock);
                }
                world.handlePlayerFinishDrag(player.getCameraLoc(), draggedBlocks.ToList(), finishDragClick.getDragType());
            }
        }