NetworkAnimator: OnSerialize syntax

This commit is contained in:
mischa 2024-01-02 13:27:43 +01:00
parent 275d5ad797
commit 7c87da9bc7

View File

@ -375,18 +375,11 @@ public override void OnSerialize(NetworkWriter writer, bool initialState)
{ {
for (int i = 0; i < animator.layerCount; i++) for (int i = 0; i < animator.layerCount; i++)
{ {
if (animator.IsInTransition(i)) AnimatorStateInfo st = animator.IsInTransition(i)
{ ? animator.GetNextAnimatorStateInfo(i)
AnimatorStateInfo st = animator.GetNextAnimatorStateInfo(i); : animator.GetCurrentAnimatorStateInfo(i);
writer.WriteInt(st.fullPathHash); writer.WriteInt(st.fullPathHash);
writer.WriteFloat(st.normalizedTime); writer.WriteFloat(st.normalizedTime);
}
else
{
AnimatorStateInfo st = animator.GetCurrentAnimatorStateInfo(i);
writer.WriteInt(st.fullPathHash);
writer.WriteFloat(st.normalizedTime);
}
writer.WriteFloat(animator.GetLayerWeight(i)); writer.WriteFloat(animator.GetLayerWeight(i));
} }
WriteParameters(writer, initialState); WriteParameters(writer, initialState);