started working inventory system
This commit is contained in:
@@ -21,9 +21,16 @@ public class CharacterController : MonoBehaviour
|
||||
{
|
||||
if (moveTarget != null && Time.time - lastMoveToUpdate > moveToUpdateRate)
|
||||
{
|
||||
animator.ResetTrigger("attack");
|
||||
lastMoveToUpdate = Time.time;
|
||||
MoveToPosition(moveTarget.position);
|
||||
}
|
||||
if (animator != null)
|
||||
{
|
||||
float speed = agent.velocity.magnitude;
|
||||
float normalisedSpeed = speed / agent.speed;
|
||||
animator.SetFloat("moveSpeed", normalisedSpeed);
|
||||
}
|
||||
}
|
||||
|
||||
public void LookTowards (Vector3 direction)
|
||||
@@ -33,7 +40,6 @@ public class CharacterController : MonoBehaviour
|
||||
|
||||
public void MoveToTarget (Transform target)
|
||||
{
|
||||
animator.SetBool("isMoving", true);
|
||||
moveTarget = target;
|
||||
}
|
||||
|
||||
@@ -47,6 +53,5 @@ public class CharacterController : MonoBehaviour
|
||||
{
|
||||
agent.isStopped = true;
|
||||
moveTarget = null;
|
||||
animator.SetBool("isMoving", false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user