public void Update(float elapseSeconds, float realElapseSeconds) { if (m_DownloadCounterNodes.Count <= 0) { return; } m_Accumulator += realElapseSeconds; if (m_Accumulator > m_RecordInterval) { m_Accumulator = m_RecordInterval; } m_TimeLeft -= realElapseSeconds; foreach (DownloadCounterNode downloadCounterNode in m_DownloadCounterNodes) { downloadCounterNode.Update(elapseSeconds, realElapseSeconds); } while (m_DownloadCounterNodes.Count > 0) { DownloadCounterNode downloadCounterNode = m_DownloadCounterNodes.First.Value; if (downloadCounterNode.ElapseSeconds < m_RecordInterval) { break; } ReferencePool.Release(downloadCounterNode); m_DownloadCounterNodes.RemoveFirst(); } if (m_DownloadCounterNodes.Count <= 0) { Reset(); return; } if (m_TimeLeft <= 0f) { long totalDeltaLength = 0L; foreach (DownloadCounterNode downloadCounterNode in m_DownloadCounterNodes) { totalDeltaLength += downloadCounterNode.DeltaLength; } m_CurrentSpeed = m_Accumulator > 0f ? totalDeltaLength / m_Accumulator : 0f; m_TimeLeft += m_UpdateInterval; } }