BloodAndGore/Assets/Scripts/AI/PlayerFollower.cs
2019-08-04 18:35:28 +03:00

19 lines
556 B
C#

using UnityEngine;
using Saltosion.OneWeapon.AI;
namespace Saltosion.OneWeapon {
[RequireComponent(typeof(AI.Behaviours.Follow), typeof(AI.Triggers.PlayerSighted))]
public class PlayerFollower : MonoBehaviour {
public AI.Behaviours.Follow Follow;
public AI.Triggers.PlayerSighted PlayerSighted;
private void Update() {
if (PlayerSighted.Player == null) {
Follow.Target = null;
} else {
Follow.Target = PlayerSighted.Player.transform;
}
}
}
}