public override void Clear()
 {
     if (CollsionDetector.Inside(Bounds, Settings.Instance.Gamebounds))
     {
         base.Clear();
     }
 }
        public UserInterlfaceContainer CreateInfoPannel(Selector selector, Shape bounds)
        {
            UserInterlfaceContainer ui = new UserInterlfaceContainer(selector, true);

            GameObject pannel = CreatePanel(bounds);

            ui.Add(pannel);

            Point2D   startLocation = bounds.Copy().Add(Settings.PORTRAT_SPACING);
            Rectangle portratBounds = new Rectangle(startLocation, Settings.PORTRAT_SIZE, Settings.PORTRAT_SIZE);

            foreach (GameObject i in selector.GameObjects)
            {
                ui.Add(CreatePortart(selector, i, portratBounds.Copy()));

                portratBounds.Add(new Point2D(portratBounds.Size + Settings.PORTRAT_SPACING, 0));

                if (!CollsionDetector.Inside(portratBounds, bounds.HitBox))
                {
                    portratBounds.X  = startLocation.X;
                    portratBounds.Y += portratBounds.Height + Settings.PORTRAT_SPACING;
                }

                if (!CollsionDetector.Inside(portratBounds, bounds.HitBox))
                {
                    break;
                }
            }

            return(ui);
        }
Exemple #3
0
 public MoveCommand(Point2D target)
 {
     if (CollsionDetector.Inside(target, Settings.Instance.MiniMapSize))
     {
         _target = Utils.FromBoundsToWorld(target, Settings.Instance.MiniMapSize);
     }
     else
     {
         _target = Utils.ToWorld(target);
     }
 }
        /// <summary>
        /// Returns if the Mouse is over the bounds if it has
        /// not been used anywhere else
        /// </summary>
        /// <param name="bounds"> the area </param>
        /// <param name="buttons"> Which button state Combinations it should look for </param>
        /// <returns></returns>
        public bool OverLapped(int hash, Rectangle bounds, List <MouseButtonState> buttons)
        {
            if (_chosen == 0 && CollsionDetector.Inside(ScreenPostion, bounds))
            {
                if (buttons != null && buttons.Any(i => _buttonStates[i.Button] == i.State))
                {
                    _chosen = hash;
                    return(true);
                }
            }

            return(false);
        }
Exemple #5
0
 public static bool InsideGameBounds(Point2D pt)
 {
     return(CollsionDetector.Inside(pt, Settings.Instance.Gamebounds));
 }
Exemple #6
0
 public static bool InsideGameBounds(Rectangle rect)
 {
     return(CollsionDetector.Inside(rect, Settings.Instance.Gamebounds));
 }