Initial Project Commit

This commit is contained in:
2025-10-27 17:26:17 +00:00
parent 36f31d54d1
commit bc21e94bc1
5 changed files with 48 additions and 41 deletions

View File

@@ -1,3 +1,4 @@
using RPG.Combat;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.InputSystem;
@@ -23,16 +24,24 @@ namespace RPG.Movement
{
UpdateAnimator();
}
public void StartMoveAction(Vector3 destination)
{
GetComponent<Fighter>().Cancel();
MoveTo(destination);
}
public void MoveTo(Vector3 destination)
{
navMeshAgent.destination = destination;
navMeshAgent.isStopped = false;
}
public void Stop()
{
navMeshAgent.isStopped = true;
}
private void UpdateAnimator()
{
// This is your original code, which is correct!
// It just uses the cached variables now.
Vector3 velocity = navMeshAgent.velocity;
Vector3 localVelocity = transform.InverseTransformDirection(velocity);
float speed = localVelocity.z;