bool WriteParameters(NetworkWriter writer, bool forceAll = false) { ulong dirtyBits = forceAll ? (~0ul) : NextDirtyBits(); writer.WritePackedUInt64(dirtyBits); for (int i = 0; i < parameters.Length; i++) { if ((dirtyBits & (1ul << i)) == 0) { continue; } AnimatorControllerParameter par = parameters[i]; if (par.type == AnimatorControllerParameterType.Int) { int newIntValue = Animator.GetInteger(par.nameHash); writer.WritePackedInt32(newIntValue); } else if (par.type == AnimatorControllerParameterType.Float) { float newFloatValue = Animator.GetFloat(par.nameHash); writer.WriteSingle(newFloatValue); } else if (par.type == AnimatorControllerParameterType.Bool) { bool newBoolValue = Animator.GetBool(par.nameHash); writer.WriteBoolean(newBoolValue); } } return(dirtyBits != 0); }
public static void WriteNetworkBehaviorSyncVar(this NetworkWriter writer, NetworkBehaviorSyncvar id) { writer.WritePackedUInt32(id.NetId); writer.WritePackedInt32(id.ComponentId); }