Tweaked AITarget ranges: now it's possible to evade some monsters by stopping the sub and/or turning off noisy devices, AITarget ranges can be made visible by entering "ShowAITargets" in the console, misc cleanup

This commit is contained in:
Regalis
2016-03-12 21:35:08 +02:00
parent c99f94b1de
commit d713874bd6
11 changed files with 113 additions and 104 deletions
+29 -9
View File
@@ -1,30 +1,31 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace Barotrauma
{
class AITarget
{
public static bool ShowAITargets;
public static List<AITarget> List = new List<AITarget>();
public Entity Entity;
protected float soundRange;
protected float sightRange;
private float soundRange;
private float sightRange;
public float SoundRange
{
get
{
return soundRange;
}
set { soundRange = value; }
get { return soundRange; }
set { soundRange = Math.Max(value, 0.0f); }
}
public float SightRange
{
get { return sightRange; }
set { sightRange = value; }
set { sightRange = Math.Max(value, 0.0f); }
}
public Vector2 WorldPosition
@@ -48,5 +49,24 @@ namespace Barotrauma
List.Remove(this);
}
public void Draw(SpriteBatch spriteBatch)
{
if (!ShowAITargets) return;
var rangeSprite = GUI.SubmarineIcon;
if (soundRange > 0.0f)
rangeSprite.Draw(spriteBatch,
new Vector2(WorldPosition.X, -WorldPosition.Y),
Color.Cyan * 0.1f, rangeSprite.Origin,
0.0f, soundRange / rangeSprite.size.X);
if (sightRange > 0.0f)
rangeSprite.Draw(spriteBatch,
new Vector2(WorldPosition.X, -WorldPosition.Y),
Color.Orange * 0.1f, rangeSprite.Origin,
0.0f, sightRange / rangeSprite.size.X);
}
}
}