|
@ -9,6 +9,11 @@ public class RemotePlayer : Player { |
|
|
private float walkSpeed; |
|
|
private float walkSpeed; |
|
|
private Vector3 lastPosition; |
|
|
private Vector3 lastPosition; |
|
|
|
|
|
|
|
|
|
|
|
public void Start() |
|
|
|
|
|
{ |
|
|
|
|
|
lastPosition = transform.position; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
protected override void Update() |
|
|
protected override void Update() |
|
|
{ |
|
|
{ |
|
|
DoAnimation(); |
|
|
DoAnimation(); |
|
@ -18,8 +23,8 @@ public class RemotePlayer : Player { |
|
|
|
|
|
|
|
|
private void DoAnimation() |
|
|
private void DoAnimation() |
|
|
{ |
|
|
{ |
|
|
Debug.Log("Updating remote Animation"); |
|
|
|
|
|
Vector3 dir = lastPosition - transform.position; |
|
|
Vector3 dir = lastPosition - transform.position; |
|
|
|
|
|
lastPosition = transform.position; |
|
|
Animator.SetFloat("WalkSpeed", dir.magnitude); |
|
|
Animator.SetFloat("WalkSpeed", dir.magnitude); |
|
|
transform.forward = dir.normalized; |
|
|
transform.forward = dir.normalized; |
|
|
} |
|
|
} |
|
|