public void ReservePool(int count = -1) { if (count < 0) { count = MaxPoolCount; } for (int i = m_TotalCount; i < count; i++) { m_Stack.Push(SoundObject.Create(this, m_Root)); m_TotalCount++; } }
SoundObject Borrow(bool force) { if (m_Stack.Count > 0) { return(m_Stack.Pop()); } else if (m_TotalCount < MaxPoolCount) { m_TotalCount++; return(SoundObject.Create(this, m_Root)); } else if (force) { return(SoundObject.Create(this, m_Root)); } return(null); }