More resharper cleanup

This commit is contained in:
Regalis11
2015-06-07 18:03:08 +03:00
parent f786cd3016
commit 34b79c85d6
62 changed files with 99 additions and 195 deletions
+9 -14
View File
@@ -331,7 +331,7 @@ namespace Subsurface
selectedTarget = null;
selectedTargetMemory = null;
this.targetValue = 0.0f;
targetValue = 0.0f;
UpdateTargetMemories();
@@ -372,7 +372,7 @@ namespace Subsurface
valueModifier = valueModifier * targetMemory.Priority / dist;
//dist -= targetMemory.Priority;
if (Math.Abs(valueModifier) > Math.Abs(this.targetValue) && (dist < target.SightRange * sight || dist < target.SoundRange * hearing))
if (Math.Abs(valueModifier) > Math.Abs(targetValue) && (dist < target.SightRange * sight || dist < target.SoundRange * hearing))
{
Vector2 rayStart = character.animController.limbs[0].SimPosition;
Vector2 rayEnd = target.Position;
@@ -408,12 +408,12 @@ namespace Subsurface
//float newTargetValue = valueModifier/dist;
if (selectedTarget == null || Math.Abs(valueModifier) > Math.Abs(this.targetValue))
if (selectedTarget == null || Math.Abs(valueModifier) > Math.Abs(targetValue))
{
selectedTarget = target;
selectedTargetMemory = targetMemory;
this.targetValue = valueModifier;
targetValue = valueModifier;
Debug.WriteLine(selectedTarget.entity+": "+targetValue);
}
}
@@ -479,18 +479,13 @@ namespace Subsurface
wallAttackPos.X = message.ReadFloat();
wallAttackPos.Y = message.ReadFloat();
float wanderAngle = message.ReadFloat();
float updateTargetsTimer = message.ReadFloat();
float raycastTimer = message.ReadFloat();
float coolDownTimer = message.ReadFloat();
steeringManager.WanderAngle = message.ReadFloat();
updateTargetsTimer = message.ReadFloat();
raycastTimer = message.ReadFloat();
coolDownTimer = message.ReadFloat();
int targetID = message.ReadInt32();
steeringManager.WanderAngle = wanderAngle;
this.updateTargetsTimer = updateTargetsTimer;
this.raycastTimer = raycastTimer;
this.coolDownTimer = coolDownTimer;
if (targetID>-1)
targetEntity = Entity.FindEntityByID(targetID) as IDamageable;
+1 -1
View File
@@ -30,7 +30,7 @@ namespace Subsurface
public Vector2 GetNode(Vector2 pos)
{
if (nodes.Count == 0) return Vector2.Zero;
if (currentNode==null || currentNode==Vector2.Zero || Vector2.Distance(pos, currentNode)<minDistance) currentNode = nodes.Dequeue();
if (currentNode==Vector2.Zero || Vector2.Distance(pos, currentNode)<minDistance) currentNode = nodes.Dequeue();
return currentNode;
}
+8 -9
View File
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Xml.Linq;
@@ -307,8 +306,8 @@ namespace Subsurface
soundInterval = ToolBox.GetAttributeFloat(doc.Root, "soundinterval", 10.0f);
var xSounds = doc.Root.Elements("sound");
if (xSounds.Count() > 0)
var xSounds = doc.Root.Elements("sound").ToList();
if (xSounds.Any())
{
sounds = new Sound[xSounds.Count()];
soundStates = new AIController.AiState[xSounds.Count()];
@@ -332,9 +331,9 @@ namespace Subsurface
animController.FindHull();
if (this.info.ID >= 0)
if (info.ID >= 0)
{
ID = this.info.ID;
ID = info.ID;
}
characterList.Add(this);
@@ -597,12 +596,12 @@ namespace Subsurface
drowningBar = new GUIProgressBar(new Rectangle(Game1.GraphicsWidth / 2 - width / 2, 20, width, height), Color.Blue, 1.0f);
}
drowningBar.BarSize = Character.Controlled.Oxygen / 100.0f;
drowningBar.BarSize = Controlled.Oxygen / 100.0f;
if (drowningBar.BarSize < 1.0f)
drowningBar.Draw(spriteBatch);
if (Character.Controlled.Inventory != null)
Character.Controlled.Inventory.Draw(spriteBatch);
if (Controlled.Inventory != null)
Controlled.Inventory.Draw(spriteBatch);
if (closestItem!=null)
{
@@ -634,7 +633,7 @@ namespace Subsurface
public void PlaySound(AIController.AiState state)
{
if (sounds == null || sounds.Count()==0) return;
if (sounds == null || !sounds.Any()) return;
var matchingSoundStates = soundStates.Where(x => x == state).ToList();
int selectedSound = Game1.localRandom.Next(matchingSoundStates.Count());
+2 -5
View File
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using System.Xml.Linq;
namespace Subsurface
@@ -39,7 +36,7 @@ namespace Subsurface
this.character = character;
this.limb = limb;
this.timer = delay;
timer = delay;
list.Add(this);
}
@@ -1,5 +1,4 @@
using System;
using System.Diagnostics;
using System.Linq;
using System.Xml.Linq;
using FarseerPhysics;
@@ -33,7 +32,7 @@ namespace Subsurface
{
case Physics.CollisionStairs:
Structure structure = fixture.Body.UserData as Structure;
if (stairs == null && (!inWater || TargetMovement.Y>0.0f))
if (stairs == null && (!inWater || TargetMovement.Y>0.0f) && structure!=null)
{
if (LowestLimb.SimPosition.Y<structure.SimPosition.Y)
{
+2 -4
View File
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using System.Xml.Linq;
namespace Subsurface
@@ -47,6 +44,7 @@ namespace Subsurface
jobList = new List<Job>();
XDocument doc = ToolBox.TryLoadXml(filePath);
if (doc == null) return;
foreach (XElement element in doc.Root.Elements())
{
-1
View File
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Xml.Linq;
using FarseerPhysics;
-4
View File
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Xml.Linq;
@@ -9,8 +7,6 @@ namespace Subsurface
{
class StatusEffect
{
[Flags]
public enum Target
{