public void Draw(SpriteBatch spriteBatch, GraphicsDevice graphicsDevice) { var index = 0; var viewPortHalfWidth = graphicsDevice.Viewport.Width / 2; var viewPortHeight = graphicsDevice.Viewport.Height; _drawnItemList.Clear(); if (!_sectorUiState.CanPlayerGivesCommand) { return; } if (_sectorUiState.ActiveActor is null) { return; } var orderedVisibleActors = _visibleActors.OrderBy(x => { var map = _sectorViewModelContext.Sector.Map; var activeActorNode = _sectorUiState.ActiveActor.Actor.Node; var monsterNode = x.Node; return(map.DistanceBetween(activeActorNode, monsterNode)); }).ThenBy(x => x.Actor.Person.Id).ToArray(); foreach (var item in orderedVisibleActors) { var itemOffsetX = index * MARKER_WIDTH; var rect = new Rectangle( viewPortHalfWidth + itemOffsetX, viewPortHeight - _positionOffsetY - MARKER_HEGHT, MARKER_WIDTH, MARKER_HEGHT ); var testedCombatAct = _sectorUiState.TacticalAct; if (testedCombatAct is null && _sectorUiState.ActiveActor != null) { testedCombatAct = GetDefaultCombatAct(_sectorUiState); } if (testedCombatAct is not null) { var selectedCombatActRange = testedCombatAct.Stats.Range; var map = _sectorViewModelContext.Sector.Map; var activeActorNode = _sectorUiState.ActiveActor.Actor.Node; var monsterNode = item.Actor.Node; if (selectedCombatActRange.Contains(map.DistanceBetween(activeActorNode, monsterNode))) { spriteBatch.Draw(_uiContentStorage.GetPersonMarkerTextureSheet(), rect, new Rectangle(0, 0, 16, 32), Color.White); } else { spriteBatch.Draw(_uiContentStorage.GetPersonMarkerTextureSheet(), rect, new Rectangle(16, 0, 16, 32), Color.White); } _drawnItemList.Add(new Marker(rect, item)); } else { // Old behaviour. spriteBatch.Draw(_uiContentStorage.GetPersonMarkerTextureSheet(), rect, Color.White); _drawnItemList.Add(new Marker(rect, item)); } index++; } }