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:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user