/// <summary> /// Shows the tower. /// </summary> /// <param name="canva">The canva.</param> /// <param name="visibleStart">The visible start.</param> /// <param name="visibleFinish">The visible finish.</param> internal void ShowTower(IGraphic canva, Point visibleStart, Point visibleFinish) { //Checking, is tower visible map area or not bool flag = (((ArrayPos.X + 1) * Settings.ElemSize/* - CurrentTowerParams.AttackRadius */< visibleFinish.X * Settings.ElemSize) || ((ArrayPos.Y + 1) * Settings.ElemSize/* - CurrentTowerParams.AttackRadius */< visibleFinish.Y * Settings.ElemSize)); //if ((ArrayPos.Y >= VisibleFinish.Y) || (ArrayPos.X >= VisibleFinish.X)) //if ((Flag)&&((ArrayPos.X < (VisibleStart.X-1)) || (ArrayPos.Y < (VisibleStart.Y-1)))) if ((flag) && (!(((ArrayPos.X + 1) * Settings.ElemSize/* + CurrentTowerParams.AttackRadius */> visibleStart.X * Settings.ElemSize) || ((ArrayPos.Y + 1) * Settings.ElemSize/* + CurrentTowerParams.AttackRadius */> visibleStart.Y * Settings.ElemSize)))) flag = false; if (!flag) return; canva.DrawImage(CurrentTowerParams.Picture, Convert.ToInt32((-(CurrentTowerParams.Picture.Width / 2) + (ArrayPos.X + 1 - visibleStart.X) * Settings.ElemSize) * Scaling + Settings.DeltaX), Convert.ToInt32((-(CurrentTowerParams.Picture.Height / 2) + (ArrayPos.Y + 1 - visibleStart.Y) * Settings.ElemSize) * Scaling + Settings.DeltaY), Convert.ToInt32(CurrentTowerParams.Picture.Width * Scaling), Convert.ToInt32(CurrentTowerParams.Picture.Height * Scaling)); if (_wasCrit == 0) return; _wasCrit--; //Critical strike notification canva.DrawString( string.Format("{0}!", CurrentTowerParams.Damage * CurrentTowerParams.CritMultiple), new Font("Arial", 20), new SolidBrush(Color.Red), new PointF( (-(CurrentTowerParams.Picture.Width / 2) + (ArrayPos.X + 1 - visibleStart.X) * Settings.ElemSize) * Scaling + Settings.DeltaX, (-(CurrentTowerParams.Picture.Height / 2) + (ArrayPos.Y + 1 - visibleStart.Y) * Settings.ElemSize) * Scaling + Settings.DeltaY)); }
/// <summary> /// Shows the tower shop page. /// </summary> /// <param name="graphObject">Graphic render object</param> private void ShowTowerShopPage(IGraphic graphObject) { ShopPageAction((int i, int j, int offset, int xMouse, int yMouse) => { graphObject.DrawImage(_towerIcons[(CurrentShopPage - 1) * (Settings.LinesInOnePage * Settings.MaxTowersInLine) + offset], BuildRectPage(i, j)); if (TowerConfSelectedID == (CurrentShopPage - 1) * (Settings.LinesInOnePage * Settings.MaxTowersInLine) + offset) //Border line graphObject.DrawRectangle(new Pen(Color.Red, Settings.PenWidth * Scaling), BuildRectPage(i, j)); return false; }); }
/// <summary> /// Shows the monster. /// </summary> /// <param name="canva">The canva.</param> /// <param name="visibleStart">The visible map area start.</param> /// <param name="visibleFinish">The visible map area finish.</param> internal void ShowMonster(IGraphic canva, Point visibleStart, Point visibleFinish) { if (_currentBaseParams.Invisible) return; if (!InVisibleMapArea(visibleStart, visibleFinish)) return; //Unit picture Bitmap tmp = _params[GetDirection, _movingPhase]; //Real coords calculating int realX = Settings.DeltaX + (int)((_canvaPos.X - visibleStart.X * Settings.ElemSize) * Scaling); int realY = Settings.DeltaY + (int)((_canvaPos.Y - visibleStart.Y * Settings.ElemSize) * Scaling); canva.DrawImage(tmp, (int)(realX - (tmp.Width / 2.0) * Scaling), (int)(realY - (tmp.Height / 2.0) * Scaling), (int)(tmp.Width * Scaling), (int)(tmp.Height * Scaling)); #region Effect Colors int r = 0; int g = 0; int b = 0; foreach (var effect in _effects)//Effects visualization { r += effect.EffectColor.R; g += effect.EffectColor.G; b += effect.EffectColor.B; } if (r != 0 || g != 0 || b != 0) canva.FillEllipse(new SolidBrush(Color.FromArgb((byte)r, (byte)g, (byte)b)), realX - 5 * Scaling, realY - 5 * Scaling, 10 * Scaling, 10 * Scaling); #endregion Effect Colors //HP bar showing int hpLineLength = (int)(Math.Round(_currentBaseParams.HealthPoints * 100.0 / _params.Base.HealthPoints) / 10.0); if (hpLineLength < 0) hpLineLength = 0; switch (GetDirection) { case MonsterDirection.Left: case MonsterDirection.Right: canva.DrawLine(Helpers.BlackPen, realX - 5 * Scaling, realY, realX + 5 * Scaling, realY); if (hpLineLength == 0) break; canva.DrawLine(Helpers.GreenPen, realX - 5 * Scaling, realY, realX + (-5 + hpLineLength) * Scaling, realY); break; case MonsterDirection.Up: case MonsterDirection.Down: canva.DrawLine(Helpers.BlackPen, realX, realY + 5 * Scaling, realX, realY - 5 * Scaling); if (hpLineLength == 0) break; canva.DrawLine(Helpers.GreenPen, realX, realY - 5 * Scaling, realX, realY + (-5 + hpLineLength) * Scaling); break; } }