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))); }
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); }
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); }
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()); }
private void DrawBackground( Graphics gc, PointDrawingHelper helper) { Condition.Requires(gc, nameof(gc)).IsNotNull(); Condition.Requires(helper, nameof(helper)).IsNotNull(); gc.FillRectangle( _backgroundBrush, helper.GetPointRectangle()); }
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)); }
private void DrawMainBlueCircle( Graphics gc, PointDrawingHelper drawingHelper, LazerEntity lazer) { var rectangle = drawingHelper.GetPointRectangle(); gc.FillEllipse( this.GetMainBrush(lazer.State), rectangle); }
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); }
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); }
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)); }
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)); }
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)); }
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); }
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); }
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); }
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); }
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()); }
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); }
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); }