You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
514 B

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class RemotePlayer : Player {
  5. public Animator Animator;
  6. private float walkSpeed;
  7. private Vector3 lastPosition;
  8. protected override void Update()
  9. {
  10. DoAnimation();
  11. base.Update();
  12. }
  13. private void DoAnimation()
  14. {
  15. Vector3 dir = lastPosition - transform.position;
  16. Animator.SetFloat("WalkSpeed", dir.magnitude);
  17. transform.forward = dir.normalized;
  18. }
  19. }