BloodAndGore/Assets/Scripts/AI/PlayerFollower.cs

19 lines
559 B
C#
Raw Normal View History

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-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
}
}
}
}