public override void HandleInput(InputState input)
        {
            Vector2 mouse = new Vector2(input.CurrentMouseState.X, input.CurrentMouseState.Y);
            Rectangle mouseRec = new Rectangle((int)mouse.X, (int)mouse.Y, 1, 1);
            Rectangle bounds = new Rectangle((int)Position.X, (int)Position.Y,
                Texture.Width, Texture.Height);

            if (IsEnabled) {
                IsMouseOver = bounds.Contains(mouseRec);

                if (IsMouseOver && input.IsNewLeftMouseClick()) {
                    IsSelected = true;
                }

                if (IsSelected && !IsMouseOver) {
                    if (input.IsNewRightMouseClick()) {
                        IsSelected = false;
                    }
                }
            }
        }
Beispiel #2
0
 public void HandleWayPoint(InputState input, Vector2 worldMouse)
 {
     if ((Keyboard.GetState().IsKeyDown(Keys.LeftShift) ||
         Keyboard.GetState().IsKeyDown(Keys.RightShift))
         && input.IsNewRightMouseClick())
     {
         //unit.Waypoints.EnqueueWithCollisionChecking(unit.Position, Mouse, Sprites);
         Waypoints.Enqueue(worldMouse);
     }
     else if (input.IsNewRightMouseClick())
     {
         Waypoints.Clear();
         Waypoints.Enqueue(worldMouse);
     }
 }