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

20 lines
565 B
C#
Raw Normal View History

2019-08-04 17:35:24 +02:00
using UnityEngine;
using Saltosion.OneWeapon.Utils;
2019-08-04 17:35:24 +02:00
namespace Saltosion.OneWeapon.AI.Triggers {
public class PlayerSighted : Trigger {
public float Radius;
public Player Player { get; private set; }
public override bool IsTriggered(Enemy subject) {
Player = Util.GetClosestTo<Player>(transform, Radius, true);
return Player != null;
}
2019-08-04 19:48:28 +02:00
private void OnDrawGizmosSelected() {
Gizmos.color = Color.green;
Gizmos.DrawWireSphere(transform.position, Radius);
}
2019-08-04 17:35:24 +02:00
}
}