Пример #1
0
        public void Draw(IEntity entity, Graphics gc)
        {
            Condition.Requires(entity, nameof(entity)).IsNotNull();
            Condition.Requires(gc, nameof(gc)).IsNotNull();
            if (entity.Type != this.EntityType)
            {
                return;
            }

            var helper = new PointDrawingHelper(this._drawSettings, entity.X, entity.Y);

            var fireRectanleSize = new Size(
                (this._drawSettings.PointSize - 2) / 2,
                (this._drawSettings.PointSize - 2) / 2);

            var rectPositions = new[]
            {
                helper.GetCornerPointLeftTop(),
                helper.GetMiddlePointLeft(),
                helper.GetMiddlePointTop(),
                helper.GetCentrePoint()
            };

            rectPositions
            .ForEach(point =>
                     gc.FillEllipse(
                         this._fireBrush,
                         new Rectangle(point, fireRectanleSize)));
        }
Пример #2
0
        private void DrawDirection(
            Graphics gc,
            PointDrawingHelper drawingHelper,
            LazerEntity lazer)
        {
            var rectangle = drawingHelper.GetPointRectangle();
            var point1    = drawingHelper.GetCentrePoint();
            var point2    = drawingHelper.GetLazerDirectionPoint(lazer.GlowDirection);

            gc.DrawLine(this._redPen, point1, point2);
        }