Add most of research
This commit is contained in:
23
GOAP/Assets/MovingController.cs
Normal file
23
GOAP/Assets/MovingController.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.AI;
|
||||
|
||||
public class MovingController : MonoBehaviour
|
||||
{
|
||||
public string speedParameterName = "WalkingSpeed";
|
||||
|
||||
[SerializeField] private NavMeshAgent agent;
|
||||
[SerializeField] private Animator animator;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
// agent = GetComponent<NavMeshAgent>();
|
||||
// animator = GetComponent<Animator>();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
float speed = agent.velocity.magnitude;
|
||||
|
||||
animator.SetFloat(speedParameterName, speed);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user