void playerMoveToHTV() { Player = GameObject.FindGameObjectWithTag("Player"); playerNav = Player.GetComponent <UnityEngine.AI.NavMeshAgent>(); anim = Player.GetComponent <Animator>(); if (!playerNav.pathPending) { if (playerNav.remainingDistance <= playerNav.stoppingDistance) { if (!playerNav.hasPath || playerNav.velocity.sqrMagnitude == 0f) { //Debug.Log("Destination not reached yet"); HTVReached = true; anim.SetFloat("walking", 0); GameFlowManager GameFlowManager = GameObject.Find("GameFlowManager").GetComponent <GameFlowManager>(); GameFlowManager.MoveFromGameToHTV(); // Done } } } if (playerNav.velocity.sqrMagnitude > 0.2f) { //Debug.Log("player is moving"); anim.SetFloat("walking", 1); } }