artak10t 14 янв 2018, 11:20
Нашел решение, вот
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
public class Player_AnimationControllerTP : NetworkBehaviour {
public Animator playerAnimator;
private float AxisHorizontal = 0;
private float AxisVertical = 0;
private void Update()
{
BlendTreeUpdate();
if (isLocalPlayer)
{
CmdBlendTreeUpdate(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));
}
}
private void BlendTreeUpdate()
{
playerAnimator.SetFloat("AxisHorizontal", AxisHorizontal, 1, Time.deltaTime * 10f);
playerAnimator.SetFloat("AxisVertical", AxisVertical, 1, Time.deltaTime * 10f);
}
[Command]
private void CmdBlendTreeUpdate(fфloat horizontal, float vertical)
{
RpcBlendTreeUpdate(horizontal, vertical);
}
[ClientRpc]
private void RpcBlendTreeUpdate(float horizontal, float vertical)
{
AxisHorizontal = horizontal;
AxisVertical = vertical;
}
}