PickVoxel() public static method

public static PickVoxel ( EnvironmentObject env, GameSurfaceView view, IntVector2 screenPos, IntGrid3 cropGrid, MapControlPickMode pickMode, IntVector3 &pos, Direction &face ) : bool
env EnvironmentObject
view GameSurfaceView
screenPos IntVector2
cropGrid IntGrid3
pickMode MapControlPickMode
pos IntVector3
face Direction
return bool
Exemplo n.º 1
0
        void SetInitialCursorPos()
        {
            // first try to set the cursor where the mouse is
            var loc = m_game.MousePositionService.MapLocation;

            // then try the voxel in the center of the screen
            if (loc.HasValue == false)
            {
                IntVector3 pos;
                Direction  face;

                var view = m_game.Surfaces[0].Views[0];

                var center   = new IntVector2((int)view.ViewPort.Width / 2, (int)view.ViewPort.Height / 2);
                var pickMode = ((MapControl3D)m_control).Config.PickMode;

                bool hit = MousePositionService.PickVoxel(m_game, center, pickMode, out pos, out face);

                if (hit)
                {
                    loc = pos;
                }
                else
                {
                    loc = null;
                }
            }

            this.Location = loc;
        }
Exemplo n.º 2
0
 public static bool PickVoxel(MyGame game, IntVector2 screenPos, MapControlPickMode pickMode, out IntVector3 pos, out Direction face)
 {
     return(MousePositionService.PickVoxel(game.Environment, game.Surfaces[0].Views[0], screenPos,
                                           game.ViewGridProvider.ViewGrid, pickMode, out pos, out face));
 }