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.

26 lines
562 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. Debug.Log("Updating remote Animation");
  16. Vector3 dir = lastPosition - transform.position;
  17. Animator.SetFloat("WalkSpeed", dir.magnitude);
  18. transform.forward = dir.normalized;
  19. }
  20. }