2019-08-04 17:35:24 +02:00
|
|
|
using UnityEngine;
|
2019-08-07 22:54:18 +02:00
|
|
|
using Saltosion.OneWeapon.Utils;
|
2019-08-14 16:17:48 +02:00
|
|
|
using Saltosion.OneWeapon.Player;
|
|
|
|
using Saltosion.OneWeapon.Enemies;
|
2019-08-04 17:35:24 +02:00
|
|
|
|
|
|
|
namespace Saltosion.OneWeapon.AI.Triggers {
|
|
|
|
public class PlayerSighted : Trigger {
|
|
|
|
public float Radius;
|
2019-08-14 16:17:48 +02:00
|
|
|
public PlayerController Player { get; private set; }
|
2019-08-04 17:35:24 +02:00
|
|
|
|
|
|
|
public override bool IsTriggered(Enemy subject) {
|
2019-08-14 16:17:48 +02:00
|
|
|
Player = Util.GetClosestTo<PlayerController>(transform, Radius, true);
|
2019-08-04 17:35:24 +02:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|