public void Update() { MouseState mouse = Mouse.GetState(); KeyboardState keyboard = Keyboard.GetState(); var currentHoverVoxel = GetVoxelUnderMouse(); if (!currentHoverVoxel.IsValid) { return; } bool isNewVoxelUnderMouse = currentHoverVoxel.IsValid && currentHoverVoxel != VoxelUnderMouse; // Prevent selection of top layer because building here causes graphical glitches. if (SelectionType == VoxelSelectionType.SelectEmpty && currentHoverVoxel.Coordinate.Y == World.WorldSizeInVoxels.Y - 1) { return; } VoxelUnderMouse = currentHoverVoxel; World.Renderer.CursorLightPos = currentHoverVoxel.WorldPosition + new Vector3(0.5f, 0.5f, 0.5f); if (!Enabled) { return; } // Get the type of the voxel and display it to the player. if (Enabled && !currentHoverVoxel.IsEmpty && currentHoverVoxel.IsExplored) { string info = currentHoverVoxel.Type.Name; // If it belongs to a room, display that information. if (World.IsInZone(currentHoverVoxel)) { var room = World.GetMostLikelyZone(currentHoverVoxel); if (room != null) { info += " (" + room.ID + ")"; } } World.UserInterface.ShowInfo(info); } bool altPressed = HandleAltPressed(mouse, keyboard, ref isNewVoxelUnderMouse); // Draw a box around the current voxel under the mouse. if (currentHoverVoxel.IsValid && DrawVoxel) { BoundingBox box = currentHoverVoxel.GetBoundingBox().Expand(0.05f); Drawer3D.DrawBox(box, CurrentColor, CurrentWidth, true); } HandleMouseButton(mouse.LeftButton, currentHoverVoxel, isNewVoxelUnderMouse, altPressed, ref isLeftPressed, InputManager.MouseButton.Left); HandleMouseButton(mouse.RightButton, currentHoverVoxel, isNewVoxelUnderMouse, altPressed, ref isRightPressed, InputManager.MouseButton.Right); }