Пример #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
        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 rectangle = helper.GetPointRectangle();

            var player = (PlayerEntity)entity;

            if (player.Is(PlayerState.Died))
            {
                gc.FillEllipse(this._blackBrush, rectangle);
                return;
            }

            var shift = this.GetJumpPhaseShift();

            rectangle.Offset(new Point(0, -shift));

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

            Condition.Requires(gc, nameof(gc)).IsNotNull();

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

            gc.DrawArc(
                _pen,
                helper.GetPointRectangle(0.2),
                0,
                360);

            var points = new[]
            {
                helper.GetPoint(0.7, 0.2),
                helper.GetPoint(0.3, 0.3),
                helper.GetPoint(0.5, 0.5)
            };

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

            Condition.Requires(gc, nameof(gc)).IsNotNull();

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

            gc.FillRectangle(this._brush, helper.GetPointRectangle());

            gc.DrawLine(
                this._pen,
                helper.GetCornerPointLeftTop(),
                helper.GetCornerPointRightDown());

            gc.DrawLine(
                this._pen,
                helper.GetCornerPointRightTop(),
                helper.GetCornerPointLeftDown());
        }
Пример #5
0
        private void DrawBackground(
            Graphics gc,
            PointDrawingHelper helper)
        {
            Condition.Requires(gc, nameof(gc)).IsNotNull();
            Condition.Requires(helper, nameof(helper)).IsNotNull();

            gc.FillRectangle(
                _backgroundBrush,
                helper.GetPointRectangle());
        }
Пример #6
0
        private void DrawOutline(
            Graphics gc,
            PointDrawingHelper helper)
        {
            Condition.Requires(gc, nameof(gc)).IsNotNull();
            Condition.Requires(helper, nameof(helper)).IsNotNull();

            gc.DrawRectangle(
                _outlinePen,
                helper.GetPointRectangle(offsetFromSide: 1));
        }
Пример #7
0
        private void DrawMainBlueCircle(
            Graphics gc,
            PointDrawingHelper drawingHelper,
            LazerEntity lazer)
        {
            var rectangle = drawingHelper.GetPointRectangle();

            gc.FillEllipse(
                this.GetMainBrush(lazer.State),
                rectangle);
        }
Пример #8
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);
        }
Пример #9
0
        private void DrawMainRectangle(
            Graphics gc,
            PointDrawingHelper helper)
        {
            Condition.Requires(gc, nameof(gc)).IsNotNull();
            Condition.Requires(helper, nameof(helper)).IsNotNull();

            var mainRectangle = helper.GetPointRectangle();

            gc.FillEllipse(this._blackBrush, mainRectangle);
        }
Пример #10
0
        private void DrawStick(
            Graphics gc,
            PointDrawingHelper helper)
        {
            Condition.Requires(gc, nameof(gc)).IsNotNull();
            Condition.Requires(helper, nameof(helper)).IsNotNull();

            gc.DrawLine(this._stickPen,
                        helper.GetPoint(0.3, 0.3),
                        helper.GetPoint(0.9, 0.9));
        }
Пример #11
0
        private void DrawFire(
            Graphics gc,
            PointDrawingHelper helper)
        {
            Condition.Requires(gc, nameof(gc)).IsNotNull();
            Condition.Requires(helper, nameof(helper)).IsNotNull();

            gc.DrawLine(this._firePen,
                        helper.GetPoint(0.2, 0.2),
                        helper.GetPoint(0.4, 0.4));
        }
Пример #12
0
        private void DrawInnerEntity(
            Graphics gc,
            PointDrawingHelper helper,
            ToolOnMapEntity toolOnMap)
        {
            Condition.Requires(gc, nameof(gc)).IsNotNull();
            Condition.Requires(helper, nameof(helper)).IsNotNull();
            Condition.Requires(toolOnMap, nameof(toolOnMap)).IsNotNull();

            this._painters
            .ForEach(painter => painter.Draw(toolOnMap.InnerEntity, gc));
        }
Пример #13
0
        private void DrawWickRectangle(
            BombEntity bomb,
            Graphics gc,
            PointDrawingHelper helper)
        {
            Condition.Requires(bomb, nameof(bomb)).IsNotNull();
            Condition.Requires(gc, nameof(gc)).IsNotNull();
            Condition.Requires(helper, nameof(helper)).IsNotNull();

            var wickRectangle = helper.GetPointRectangle(0.1);

            gc.FillEllipse(
                this.GetWickBruch(bomb),
                wickRectangle);
        }
Пример #14
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 bomb   = (BombEntity)entity;
            var helper = new PointDrawingHelper(this._drawSettings, entity.X, entity.Y);

            this.DrawMainRectangle(gc, helper);
            this.DrawWickRectangle(bomb, gc, helper);
        }
Пример #15
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);

            this.DrawStick(gc, helper);
            this.DrawFire(gc, helper);
        }
Пример #16
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 lazerRay = (LazerRayEntity)entity;


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

            this.DrawDirection(gc, helper, lazerRay);
        }
Пример #17
0
        private void DrawDirection(
            Graphics gc,
            PointDrawingHelper drawingHelper,
            MirrorEntity mirror)
        {
            var rectangle = drawingHelper.GetPointRectangle();

            var point1 = mirror.Position == MirrorPosition.MainDiagonal
                ? drawingHelper.GetCornerPointLeftTop()
                : drawingHelper.GetCornerPointRightTop();

            var point2 = mirror.Position == MirrorPosition.MainDiagonal
                ? drawingHelper.GetCornerPointRightDown()
                : drawingHelper.GetCornerPointLeftDown();

            gc.DrawLine(this._brownPen, point1, point2);
            gc.DrawLine(this._bluePen, point1, point2);
        }
        public void Draw(
            IEntity entity,
            Graphics gc)
        {
            Condition.Requires(entity, nameof(entity)).IsNotNull();
            if (entity.Type != this.EntityType)
            {
                return;
            }

            Condition.Requires(gc, nameof(gc)).IsNotNull();

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

            gc.DrawRectangle(
                _pen,
                helper.GetPointRectangle());
        }
Пример #19
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 mirror = (MirrorEntity)entity;


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

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

            var toolOnMap = (ToolOnMapEntity)entity;

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

            this.DrawBackground(gc, helper);
            this.DrawInnerEntity(gc, helper, toolOnMap);
            this.DrawOutline(gc, helper);
        }