Ejemplo n.º 1
0
 public static void BuildMessage(InputAnimatorMessage message)
 {
     foreach (KeyValuePair <NetworkInstanceId, NetworkIdentity> networkIdentity in NetworkServer.objects)
     {
         if (networkIdentity.Value.gameObject.GetComponent <Animator>() != null)
         {
             StoredAnimator animator = new StoredAnimator();
             animator.networkId    = networkIdentity.Key.Value;
             animator.animatorTime = networkIdentity.Value.gameObject.GetComponent <Animator>().GetCurrentAnimatorStateInfo(0).normalizedTime;
             message.animators.Add(animator);
         }
     }
 }
Ejemplo n.º 2
0
        public static void ProcessMessage(InputAnimatorMessage message)
        {
            Dictionary <NetworkInstanceId, NetworkIdentity> networkIdentities = ClientScene.objects;

            foreach (StoredAnimator storedAnimator in message.animators)
            {
                NetworkInstanceId networkInstanceId = new NetworkInstanceId(storedAnimator.networkId);
                if (networkIdentities.ContainsKey(networkInstanceId))
                {
                    Animator animator = networkIdentities[networkInstanceId].GetComponent <Animator>();
                    if (animator != null)
                    {
                        animator.Update(storedAnimator.animatorTime - animator.GetCurrentAnimatorStateInfo(0).normalizedTime);
                    }
                }
            }
        }