private void DrawSurface() { _drawer.DrawSurface(curRect.Width, curRect.Height); var visibleCells = Map.RectToCellRect(Map.VisibleRect); var lightObjectsList = new List <BurningProps>(); //var mapSize = _map.GetSize(); for (int j = visibleCells.Top; j < visibleCells.Top + visibleCells.Height; j++) { for (int i = visibleCells.Left; i < visibleCells.Left + visibleCells.Width; i++) { var gameObject = Map.GetHObjectFromCell(new Point(i, j)); if (gameObject == null) { continue; } if (gameObject is LargeObjectOuterAbstract largeObjectOuter && !largeObjectOuter.isLeftCorner) { continue; } var visibleDestination = Map.GetVisibleDestinationFromRealDestination(Map.CellToPoint(new Point(i, j))); var drawingCode = GetDrawingCode(gameObject); _drawer.DrawObject(drawingCode, visibleDestination.X, visibleDestination.Y, gameObject.Height); if (gameObject is IBurning burning) { lightObjectsList.Add(new BurningProps(visibleDestination, burning.LightRadius)); } } if ((j * Map.CellMeasure <= _hero.Position.Y) && ((j + 1) * Map.CellMeasure > _hero.Position.Y)) { _drawer.DrawHero(Map.GetVisibleDestinationFromRealDestination(_hero.Position), _hero.Angle, _hero.PointList.Select(p => Map.GetVisibleDestinationFromRealDestination(p)).ToList(), _hero.IsHorizontal()); } } var mobileObjects = Map.GetMobileObjects(); foreach (var mobileObject in mobileObjects) { if (Map.PointInVisibleRect(mobileObject.Position)) { var visibleDestination = Map.GetVisibleDestinationFromRealDestination(mobileObject.Position); _drawer.DrawObject(mobileObject.GetDrawingCode(), visibleDestination.X, visibleDestination.Y, mobileObject.Height); } } // _drawer.DrawHero(Map.GetVisibleDestinationFromRealDestination(_hero.Position), _hero.Angle, _hero.PointList.Select(p => Map.GetVisibleDestinationFromRealDestination(p)).ToList(), _hero.IsHorizontal()); if (IsHeroInInnerMap()) { var innerMapSize = Map.GetInnerMapRect(); var visibleDestination = Map.GetVisibleDestinationFromRealDestination(Map.CellToPoint(new Point(innerMapSize.Left, innerMapSize.Top))); _drawer.DrawShaddow(visibleDestination, new Size(innerMapSize.Width, innerMapSize.Height)); } else { _drawer.DrawDayNight(_dayNightCycle.Lightness(), lightObjectsList); } _drawer.DrawActing(_hero.State.ShowActing); }