public override void Update(GameTime gameTime) { if (GetInformation != null) { Information = GetInformation(); } if (GetRectangle != null) { Rectangle = GetRectangle(); } if (GameMouse.Intersects(Rectangle)) { OnHover?.Invoke(); IsHover = true; if (GameMouse.IsLeftClicked) { OnSelected?.Invoke(); IsSelected = true; } } else { OffHover.Invoke(); IsHover = false; if (GameMouse.IsLeftClicked && !GameKeyboard.IsKeyDown(Keys.LeftShift)) { OffSelected?.Invoke(); IsSelected = false; } } }
public void Update(GameTime gameTime) { _previousScrollValue = _currentScrollValue; _currentScrollValue = GameMouse.ScrollWheelValue; if (GameMouse.Intersects(_innerRectangle) && GameMouse.IsLeftPressed) { _isSelected = true; } if (GameMouse.IsLeftReleased) { _isSelected = false; } if (_isSelected) { _innerY = GameMouse.Y - (_innerRectangle.Height / 2); } if (_previousScrollValue != _currentScrollValue && GameMouse.Intersects(ScrollArea)) { _innerY += (_previousScrollValue - _currentScrollValue) / 10; } _innerY = MathHelper.Clamp(_innerY, (int)Position.Y + _padding, ((int)Position.Y + _outer.Height - _padding) - _innerRectangle.Height); }
public override void Update(GameTime gameTime) { base.Update(gameTime); _showBorder = false; if (GameMouse.Intersects(this.Rectangle)) { _showBorder = true; if (GameMouse.IsLeftClicked) { } } }
public void Update(GameTime gameTime) { if (GameMouse.Intersects(ClickRectangle, true)) { GameMouse.AddObject(this); } else { GameMouse.ClickableObjects.Remove(this); } foreach (var component in Components) { component.Update(gameTime); } foreach (var entity in Entities) { entity.Update(gameTime); } }
public override List <Actor> GetTargets(IEnumerable <Actor> enemies) { var targets = new List <Actor>(); var enemy = enemies.Where(c => GameMouse.Intersects(c.Rectangle)).FirstOrDefault(); if (enemy != null) { switch (_ability.TargetType) { case AbilityModel.TargetTypes.Single: enemy.ShowBorder = true; targets.Add(enemy); break; case AbilityModel.TargetTypes.All: foreach (var target in enemies) { target.ShowBorder = true; targets.Add(target); } break; default: break; } if (GameMouse.IsLeftClicked) { ActionResult.State = Engine.ActionStates.Running; } } return(targets); }