Exemplo n.º 1
0
 public override bool OnSerialize(NetworkWriter writer, bool initialState)
 {
     writer.WriteInt32(value);
     // one too many
     writer.WriteInt32(value);
     return(true);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Custom Serialization
 /// </summary>
 /// <param name="writer"></param>
 /// <param name="initialState"></param>
 /// <returns></returns>
 public override bool OnSerialize(NetworkWriter writer, bool initialState)
 {
     if (initialState)
     {
         for (int i = 0; i < Animator.layerCount; i++)
         {
             if (Animator.IsInTransition(i))
             {
                 AnimatorStateInfo st = Animator.GetNextAnimatorStateInfo(i);
                 writer.WriteInt32(st.fullPathHash);
                 writer.WriteSingle(st.normalizedTime);
             }
             else
             {
                 AnimatorStateInfo st = Animator.GetCurrentAnimatorStateInfo(i);
                 writer.WriteInt32(st.fullPathHash);
                 writer.WriteSingle(st.normalizedTime);
             }
             writer.WriteSingle(Animator.GetLayerWeight(i));
         }
         WriteParameters(writer, initialState);
         return(true);
     }
     return(false);
 }