/// <summary> /// Lets the game respond to player input. Unlike the Update method, /// this will only be called when the gameplay screen is active. /// </summary> public override void HandleInput(InputState input) { //is an object being grabbed? if(input.Mouse.IsNewLeftMouseClick) { int count = 0; float mx = Camera1.Relative2Dto3D(input.Mouse.Position).X; float my = Camera1.Relative2Dto3D(input.Mouse.Position).Y; foreach (var piece in Level.Pieces) { float oRadius = piece.ObjectModel.Meshes[0].BoundingSphere.Radius; if(mx < piece.Position.X + oRadius && mx > piece.Position.X - oRadius && my < piece.Position.Y + oRadius && my > piece.Position.Y - oRadius) { ++count; objectGrabbed = piece; } } DisplayedMessages["levelEditor"] = "clicking on " + count + " number of objects. @ cur pos: " + mx + ", " + my; } //is an object being released? if(input.Mouse.IsNewLeftMouseRelease) objectGrabbed = null; //stick the object to the cursor if it's currently grabbed. if(objectGrabbed != null && input.Mouse.LeftMouseDown) { objectGrabbed.Position = input.Mouse.Position3DSpace; } }
/*public KeyboardState CurrentKeyboard { get { return _currentKeyboard; } set { _currentKeyboard = value; } } public GamePadState CurrentGamePad { get { return _currentGamePad; } set { _currentGamePad = value; } } public MouseState GameMouse { get { return _gameMouse; } set { _gameMouse = value; } }*/ public HumanPlayer(Screens.GameplayScreen gameplayScreen, Vector3 respawnPoint) : base(gameplayScreen, respawnPoint) { Input = new InputState(); }