Some cleanup using ReSharper (mostly removing redundancies)
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
|
||||
using FarseerPhysics;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Barotrauma.Lights;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -165,8 +165,6 @@ namespace Barotrauma
|
||||
|
||||
for (int i = 0; i < count; i++ )
|
||||
{
|
||||
float normalizedPos = 0.5f-(i / count);
|
||||
|
||||
Vector2 spawnPos = new Vector2(WorldPosition.X + Rand.Range(0.0f, size.X), Rand.Range(WorldPosition.Y - size.Y, WorldPosition.Y) + 10.0f);
|
||||
|
||||
Vector2 speed = new Vector2((spawnPos.X - (WorldPosition.X + size.X / 2.0f)), (float)Math.Sqrt(size.X) * Rand.Range(10.0f, 15.0f) * growModifier);
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace Barotrauma
|
||||
|
||||
public static void UpdateHulls()
|
||||
{
|
||||
foreach (Gap g in Gap.GapList)
|
||||
foreach (Gap g in GapList)
|
||||
{
|
||||
g.FindHulls();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Content;
|
||||
|
||||
@@ -112,21 +112,16 @@ namespace Barotrauma.Lights
|
||||
|
||||
private void CalculateDimensions()
|
||||
{
|
||||
Vector2 center = Vector2.Zero;
|
||||
|
||||
float? minX = null, minY = null, maxX = null, maxY = null;
|
||||
|
||||
for (int i = 0; i < vertices.Length; i++)
|
||||
{
|
||||
center += vertices[i];
|
||||
|
||||
if (minX == null || vertices[i].X < minX) minX = vertices[i].X;
|
||||
if (minY == null || vertices[i].Y < minY) minY = vertices[i].Y;
|
||||
|
||||
if (maxX == null || vertices[i].X > maxX) maxX = vertices[i].X;
|
||||
if (maxY == null || vertices[i].Y > minY) maxY = vertices[i].Y;
|
||||
}
|
||||
center /= vertices.Length;
|
||||
|
||||
boundingBox = new Rectangle((int)minX, (int)minY, (int)(maxX - minX), (int)(maxY - minY));
|
||||
}
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
|
||||
@@ -151,11 +151,11 @@ namespace Barotrauma
|
||||
|
||||
protected bool ResizeHorizontal
|
||||
{
|
||||
get { return prefab == null ? false : prefab.ResizeHorizontal; }
|
||||
get { return prefab != null && prefab.ResizeHorizontal; }
|
||||
}
|
||||
protected bool ResizeVertical
|
||||
{
|
||||
get { return prefab == null ? false : prefab.ResizeVertical; }
|
||||
get { return prefab != null && prefab.ResizeVertical; }
|
||||
}
|
||||
|
||||
public virtual string Name
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Xml.Linq;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Barotrauma
|
||||
@@ -13,17 +11,17 @@ namespace Barotrauma
|
||||
//public static List<StructurePrefab> list = new List<StructurePrefab>();
|
||||
|
||||
//does the structure have a physics body
|
||||
bool hasBody;
|
||||
private bool hasBody;
|
||||
|
||||
bool castShadow;
|
||||
private bool castShadow;
|
||||
|
||||
bool isPlatform;
|
||||
Direction stairDirection;
|
||||
private bool isPlatform;
|
||||
private Direction stairDirection;
|
||||
|
||||
float maxHealth;
|
||||
private float maxHealth;
|
||||
|
||||
//default size
|
||||
Vector2 size;
|
||||
private Vector2 size;
|
||||
|
||||
public bool HasBody
|
||||
{
|
||||
@@ -55,7 +53,7 @@ namespace Barotrauma
|
||||
foreach (string filePath in filePaths)
|
||||
{
|
||||
XDocument doc = ToolBox.TryLoadXml(filePath);
|
||||
if (doc == null) return;
|
||||
if (doc == null || doc.Root == null) return;
|
||||
|
||||
foreach (XElement el in doc.Root.Elements())
|
||||
{
|
||||
|
||||
@@ -165,7 +165,7 @@ namespace Barotrauma
|
||||
|
||||
public bool AtDamageDepth
|
||||
{
|
||||
get { return subBody == null ? false : subBody.AtDamageDepth; }
|
||||
get { return subBody != null && subBody.AtDamageDepth; }
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
||||
@@ -310,7 +310,7 @@ namespace Barotrauma
|
||||
|
||||
if (hull.Rect.Width<minDist*3.0f)
|
||||
{
|
||||
var wayPoint = new WayPoint(
|
||||
new WayPoint(
|
||||
new Vector2(hull.Rect.X + hull.Rect.Width / 2.0f, hull.Rect.Y - hull.Rect.Height + heightFromFloor), SpawnType.Path, Submarine.Loaded);
|
||||
continue;
|
||||
}
|
||||
@@ -396,7 +396,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
List<Structure> stairList = new List<Structure>();
|
||||
foreach (MapEntity me in MapEntity.mapEntityList)
|
||||
foreach (MapEntity me in mapEntityList)
|
||||
{
|
||||
Structure stairs = me as Structure;
|
||||
if (stairs == null) continue;
|
||||
@@ -439,8 +439,7 @@ namespace Barotrauma
|
||||
ladderPoints[0] = new WayPoint(new Vector2(item.Rect.Center.X, item.Rect.Y - item.Rect.Height + heightFromFloor), SpawnType.Path, Submarine.Loaded);
|
||||
|
||||
ladderPoints[1] = new WayPoint(new Vector2(item.Rect.Center.X, item.Rect.Y-1.0f), SpawnType.Path, Submarine.Loaded);
|
||||
|
||||
|
||||
|
||||
|
||||
WayPoint prevPoint = ladderPoints[0];
|
||||
Vector2 prevPos = prevPoint.SimPosition;
|
||||
@@ -457,7 +456,7 @@ namespace Barotrauma
|
||||
|
||||
if (pickedBody.UserData is Item)
|
||||
{
|
||||
var door = (pickedBody.UserData as Item).GetComponent<Door>();
|
||||
var door = ((Item)pickedBody.UserData).GetComponent<Door>();
|
||||
if (door != null)
|
||||
{
|
||||
WayPoint newPoint = new WayPoint(door.Item.Position, SpawnType.Path, Submarine.Loaded);
|
||||
|
||||
Reference in New Issue
Block a user