Exemplo n.º 1
0
        public override void Update(GameTime gameTime)
        {
            bool       atBlankSpace = true;
            MouseState mouse        = Mouse.GetState();

            for (int i = 0; i < clickables.Count; i++)
            {
                IClickable clickable = clickables[i];
                if (Toolbox.IsPointInsideSquare(new Point(mouse.X, mouse.Y), clickable.GetBoundary()))
                {
                    atBlankSpace = false;
                    clickable.MouseEnter();
                    if (mouse.LeftButton == ButtonState.Pressed)
                    {
                        clickable.Click();
                    }
                    else
                    {
                        clickable.Release();
                    }
                }
                else
                {
                    clickable.MouseLeave();
                }
            }
            if (atBlankSpace && mouse.LeftButton == ButtonState.Pressed)
            {
                heroDetail?.Deactivate();
            }

            base.Update(gameTime);
        }