private void DrawRange() { if (SelectedUnit == null) { return; } int minRange; int maxRange; Color color; switch (Mode) { case InterfaceMode.Normal: if (SelectedUnit.WarpTarget != null) { return; } minRange = 1; maxRange = SelectedUnit.Moves; color = Color.LimeGreen; break; case InterfaceMode.TargettingWarp: minRange = SelectedUnit.UnitType.Moves * 5; maxRange = SelectedUnit.UnitType.Moves * 10; color = Color.CornflowerBlue; break; case InterfaceMode.TargettingBombard: minRange = SelectedUnit.UnitType.BombardMinRange; maxRange = SelectedUnit.UnitType.BombardMaxRange; color = Color.Red; break; default: throw new ArgumentException(); } for (int x = -maxRange; x <= maxRange; x++) { for (int y = -maxRange; y <= maxRange; y++) { if (!SelectedUnit.PositionInRange( SelectedUnit.Position + new Vector2i(x, y), minRange, maxRange ) ) { continue; } fbRectangle destination = Camera.WorldToScreen( new fbRectangle( new Vector2( SelectedUnit.x + x, SelectedUnit.y + y ) * tileSize, tileSize ) ); new DrawCall( Engine.GetTexture("blank"), destination, 10, color * 0.6f ).Draw(Engine); } } }