Looping through my network players:
Code: Select all
int id = data.GetInt("id");
int i = 0;
int total = Players.Count;
for (i = 0; i < total; i++)
{
NetworkPlayer player = Players[i];
if (player.Id == id)
{
string animation = data.GetUtfString("animation");
player.SetPlayerAnimation(animation);
}//end if
}//end for
Code on my network player:
Code: Select all
public void SetPlayerAnimation(string animation)
{
if (_animator == null) return;
string trimmed = animation.Trim();
//ANIMATION
switch (trimmed)
{
case AnimationState.IDLE:
_animator.SetInteger("AnimationState", 0);
break;
case AnimationState.WALK:
_animator.SetInteger("AnimationState", 1);
break;
case AnimationState.WALK_BACK:
_animator.SetInteger("AnimationState", 2);
break;
case AnimationState.STRAFE_LEFT:
_animator.SetInteger("AnimationState", 3);
break;
case AnimationState.STRAFE_RIGHT:
_animator.SetInteger("AnimationState", 4);
break;
default:
_animator.SetInteger("AnimationState", 0);
break;
}//end switch
}//end
It's like it only affects one player at a time. Making the animation states only set for one player? It's weird.
Any help appreciated!
Thanks,
IdleCHimp