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

22 lines
641 B
C#

using UnityEngine;
using Saltosion.OneWeapon.Utils;
using Saltosion.OneWeapon.Player;
using Saltosion.OneWeapon.Enemies;
namespace Saltosion.OneWeapon.AI.Triggers {
public class PlayerSighted : Trigger {
public float Radius;
public PlayerController Player { get; private set; }
public override bool IsTriggered() {
Player = Util.GetClosestTo<PlayerController>(transform, Radius, true);
return Player != null;
}
private void OnDrawGizmosSelected() {
Gizmos.color = Color.green;
Gizmos.DrawWireSphere(transform.position, Radius);
}
}
}