I’m working on a multiplayer game and I have a animation manager that sends RPC’s to all the players telling them to play the walking and idle animations on the player that called it, it’s not working though. Whenever any player moves all of the players play the walking animation instead of just the person walking. If you guys could help me with this I’d owe you a solid.
#pragma strict
var anim : Animation;
function Start()
{
}
function Update ()
{
if(GetComponent.<NetworkView>().isMine)
{
if(Input.GetKeyUp(KeyCode.W)||Input.GetKeyUp(KeyCode.A)||Input.GetKeyUp(KeyCode.S)||Input.GetKeyUp(KeyCode.D))
GetComponent.<NetworkView>().RPC("IdleAnimation", RPCMode.All);
// if (Input.GetButtonDown("Fire1"))
// {
//Attack animation
// networkView.RPC("PuchAnimation", RPCMode.All);
// }
// if (Input.GetButtonDown("Fire2"))
// {
//Attack animation
// networkView.RPC("Attack3Animation", RPCMode.All);
}
if (Input.GetKey(KeyCode.W)||Input.GetKey(KeyCode.A)||Input.GetKey(KeyCode.D)||Input.GetKey(KeyCode.S))
{
//Attack animation
GetComponent.<NetworkView>().RPC("WalkAnimation", RPCMode.All);
}
if(Input.GetKeyDown(KeyCode.Space))
GetComponent.<NetworkView>().RPC("JumpAnimation", RPCMode.All);
}
@RPC //IDLEANIMATION RPC
function IdleAnimation ()
{
GetComponent.<Animation>().CrossFade("Idle");
}
// @RPC //PUNCHANIMATIONRPC
// function PunchAnimation ()
// {
// animation.CrossFade("punch");
// }
// @RPC ATTACK3ANIMTION RPC
// function Attack3Animation ()
// {
// animation.CrossFade("attack3");
// }
@RPC //WALK ANIMATION RPC
function WalkAnimation ()
{
GetComponent.<Animation>().CrossFade("Walk");
}
@RPC //JUMP ANIMATION RPC
function JumpAnimation ()
{
GetComponent.<Animation>().CrossFade("jump");
}