28 lines
665 B
C#
28 lines
665 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace Net.Project.B.AI
|
|
{
|
|
public class UnityNavMeshAgentController : MonoBehaviour
|
|
{
|
|
public Vector3 Velocity;
|
|
public readonly Queue<Quaternion> QueuedDeltaRotation = new();
|
|
public event Action OnAnimatorMoved;
|
|
private Animator _animator;
|
|
|
|
private void Start()
|
|
{
|
|
_animator = GetComponent<Animator>();
|
|
}
|
|
|
|
private void OnAnimatorMove()
|
|
{
|
|
QueuedDeltaRotation.Enqueue(_animator.deltaRotation);
|
|
Velocity = _animator.velocity;
|
|
OnAnimatorMoved?.Invoke();
|
|
}
|
|
}
|
|
|
|
}
|