private void OnFollowEnter() { navAgent.isStopped = false; state = DogState.Follow; subState = DogSubState.FollowPath; startLookAtTime = float.MaxValue; animator.PlayWalk(); Repath(followOffset); }
private void Movement() { Vector3 input = new Vector3(horizontal, vertical, 0.0f); Vector3 inputDirection = input.normalized; if (inputDirection != Vector3.zero) { SetPlayerRelativeToCameraForward(); } if (Input.GetKey(KeyCode.LeftShift)) { m_speed = m_RunSpeed * inputDirection.magnitude; //Running isRunning = true; isWalking = false; } else { m_speed = m_WalkSpeed * inputDirection.magnitude; //Walking isWalking = true; isRunning = false; } transform.Translate(transform.forward * m_speed * Time.deltaTime, Space.World); //Animate if (isWalking) { m_AnimatorDriverAnimal.PlayWalk(); } if (isRunning) { m_AnimatorDriverAnimal.PlayRun(); } }