2019-08-03 17:36:17 +02:00
|
|
|
using UnityEngine;
|
|
|
|
using Saltosion.OneWeapon.AI;
|
|
|
|
|
2019-08-14 16:17:48 +02:00
|
|
|
namespace Saltosion.OneWeapon.AI {
|
2019-08-03 17:36:17 +02:00
|
|
|
[RequireComponent(typeof(AI.Behaviours.Follow), typeof(AI.Triggers.EnemySighted))]
|
|
|
|
public class EnemyFollower : MonoBehaviour {
|
|
|
|
public AI.Behaviours.Follow Follow;
|
|
|
|
public AI.Triggers.EnemySighted EnemySighted;
|
|
|
|
|
|
|
|
private void Update() {
|
|
|
|
if (EnemySighted.ClosestEnemy == null) {
|
|
|
|
Follow.Target = null;
|
|
|
|
} else {
|
|
|
|
Follow.Target = EnemySighted.ClosestEnemy.transform;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|