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

22 lines
641 B
C#
Raw Normal View History

2019-08-04 17:35:24 +02:00
using UnityEngine;
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
2019-08-14 18:05:41 +02:00
public override bool IsTriggered() {
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
}
}