Some cleanup using ReSharper (mostly removing redundancies)

This commit is contained in:
Regalis
2016-03-12 15:32:34 +02:00
parent ae4e4d8f34
commit d1580328ed
99 changed files with 197 additions and 483 deletions
@@ -215,7 +215,7 @@ namespace Barotrauma.Items.Components
character.AnimController.Anim = AnimController.Animation.None;
}
public override bool Select(Character activator = null)
public override bool Select(Character activator)
{
if (activator == null) return false;
@@ -117,7 +117,7 @@ namespace Barotrauma.Items.Components
}
else
{
if (!container.Inventory.Items.Any(i => i != null)) return;
if (container.Inventory.Items.All(i => i == null)) return;
activateButton.Text = "Cancel";
}
@@ -90,7 +90,7 @@ namespace Barotrauma.Items.Components
for (int i = 0; i < 5; i++)
{
var bubbles = GameMain.ParticleManager.CreateParticle("bubbles", item.WorldPosition - (Vector2.UnitX * item.Rect.Width/2),
GameMain.ParticleManager.CreateParticle("bubbles", item.WorldPosition - (Vector2.UnitX * item.Rect.Width/2),
-currForce / 5.0f + new Vector2(Rand.Range(-100.0f, 100.0f), Rand.Range(-50f, 50f)),
0.0f, item.CurrentHull);
}
@@ -150,7 +150,7 @@ namespace Barotrauma.Items.Components
}
text += "Required time: " + targetItem.RequiredTime + " s";
GUITextBlock textBlock = new GUITextBlock(
new GUITextBlock(
new Rectangle(0, 50, 0, 25),
text,
Color.Transparent, Color.White,
@@ -153,7 +153,6 @@ namespace Barotrauma.Items.Components
public override void DrawHUD(SpriteBatch spriteBatch, Character character)
{
int width = GuiFrame.Rect.Width, height = GuiFrame.Rect.Height;
int x = GuiFrame.Rect.X;
int y = GuiFrame.Rect.Y;
@@ -94,19 +94,14 @@ namespace Barotrauma.Items.Components
public override void DrawHUD(SpriteBatch spriteBatch, Character character)
{
int x = GuiFrame.Rect.X;
int y = GuiFrame.Rect.Y;
GuiFrame.Update(1.0f / 60.0f);
GuiFrame.Draw(spriteBatch);
if (voltage < minVoltage) return;
int radius = GuiFrame.Rect.Height / 2 - 30;
DrawRadar(spriteBatch, new Rectangle((int)GuiFrame.Center.X - radius, (int)GuiFrame.Center.Y - radius, radius * 2, radius * 2));
//voltage = 0.0f;
}
private List<RadarBlip> radarBlips;
@@ -202,20 +197,15 @@ namespace Barotrauma.Items.Components
float pointDist = (limb.WorldPosition - item.WorldPosition).Length() * displayScale;
if (limb.SimPosition == Vector2.Zero || pointDist > radius) continue;
if (pointDist > radius) continue;
if (pointDist > prevPingRadius && pointDist < pingRadius)
{
float limbSize = limb.Mass;
for (int i = 0; i<=limb.Mass/100.0f; i++)
{
var blip = new RadarBlip(limb.WorldPosition+Rand.Vector(limb.Mass/10.0f), 1.0f);
radarBlips.Add(blip);
}
}
}
}
@@ -379,12 +379,12 @@ namespace Barotrauma.Items.Components
public override bool Pick(Character picker)
{
return (picker != null);
return picker != null;
}
public override void Draw(SpriteBatch spriteBatch, bool editing)
public override void Draw(SpriteBatch spriteBatch, bool editing = false)
{
base.Draw(spriteBatch);
base.Draw(spriteBatch, editing);
GUI.DrawRectangle(spriteBatch,
new Vector2(item.Rect.X + item.Rect.Width / 2 - 6, -item.Rect.Y + 29),