Initial Project Commit
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user