BloodAndGore/Assets/Scripts/AI/Triggers/EnemySighted.cs

17 lines
495 B
C#
Raw Normal View History

2019-08-22 18:59:36 +02:00
using UnityEngine;
using Saltosion.OneWeapon.Utils;
2019-08-14 16:17:48 +02:00
using Saltosion.OneWeapon.Enemies;
2019-08-03 17:36:17 +02:00
namespace Saltosion.OneWeapon.AI.Triggers {
public class EnemySighted : Trigger {
2019-08-22 18:59:36 +02:00
public LayerMask SearchLayerMask;
2019-08-03 17:36:17 +02:00
public float Radius;
public Enemy ClosestEnemy { get; private set; }
2019-08-14 18:05:41 +02:00
public override bool IsTriggered() {
2019-08-22 18:59:36 +02:00
ClosestEnemy = Util.GetClosestTo<Enemy>(transform, Radius, SearchLayerMask);
2019-08-03 18:14:47 +02:00
return ClosestEnemy != null;
2019-08-03 17:36:17 +02:00
}
}
}