2019-08-03 17:36:17 +02:00
|
|
|
using UnityEngine;
|
|
|
|
using Saltosion.OneWeapon.AI;
|
|
|
|
|
|
|
|
namespace Saltosion.OneWeapon {
|
2019-08-04 17:35:24 +02:00
|
|
|
[RequireComponent(typeof(AI.Behaviours.Follow), typeof(AI.Triggers.PlayerSighted))]
|
|
|
|
public class PlayerFollower : MonoBehaviour {
|
2019-08-03 17:36:17 +02:00
|
|
|
public AI.Behaviours.Follow Follow;
|
2019-08-04 17:35:24 +02:00
|
|
|
public AI.Triggers.PlayerSighted PlayerSighted;
|
2019-08-03 17:36:17 +02:00
|
|
|
|
|
|
|
private void Update() {
|
2019-08-04 17:35:24 +02:00
|
|
|
if (PlayerSighted.Player == null) {
|
2019-08-03 17:36:17 +02:00
|
|
|
Follow.Target = null;
|
|
|
|
} else {
|
2019-08-04 17:35:24 +02:00
|
|
|
Follow.Target = PlayerSighted.Player.transform;
|
2019-08-03 17:36:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|