(842e6af33) Human AI needs AITargets too (not much, but they are still useful). Therefor add Type property to AITargets, so that certain targets can be treated human only and others enemy only. Implement target filtering in the Enemy AI Controller.

This commit is contained in:
Joonas Rikkonen
2019-04-08 11:58:50 +03:00
parent c3ab4b6899
commit 55eecc49d8
3 changed files with 77 additions and 50 deletions
@@ -66,6 +66,22 @@ namespace Barotrauma
public float MinSoundRange, MinSightRange;
public float MaxSoundRange = float.MaxValue, MaxSightRange = float.MaxValue;
public TargetType Type { get; private set; }
public enum TargetType
{
Any,
HumanOnly,
EnemyOnly
}
public string SonarLabel;
public bool Enabled = true;
public float MinSoundRange, MinSightRange;
public float MaxSoundRange = float.MaxValue, MaxSightRange = float.MaxValue;
public Vector2 WorldPosition
{
get
@@ -113,6 +129,11 @@ namespace Barotrauma
MaxSightRange = element.GetAttributeFloat("maxsightrange", SightRange);
MaxSoundRange = element.GetAttributeFloat("maxsoundrange", SoundRange);
SonarLabel = element.GetAttributeString("sonarlabel", "");
string typeString = element.GetAttributeString("type", "Any");
if (Enum.TryParse(typeString, out TargetType t))
{
Type = t;
}
}
public AITarget(Entity e, float sightRange = -1, float soundRange = 0)