public UnityEngine.GameObject NextObjectInCache() { UnityEngine.GameObject obj = null; for (int i = 0; i < m_cacheSize; i++) { obj = m_objects[m_cacheIndex]; // If we found an inactive object in the cache, use that. if (!obj.activeSelf) { break; } // If not, increment index and make it loop around // if it exceeds the size of the cache m_cacheIndex = (m_cacheIndex + 1) % m_cacheSize; } if (obj.activeSelf) { CRoleManger.Destroy(obj); } // Increment index and make it loop around // if it exceeds the size of the cache m_cacheIndex = (m_cacheIndex + 1) % m_cacheSize; return(obj); }
public CRoleManger() { m_caches = new CObjectCache[2]; m_rolemgr = this; int amount = 0; for (int i = 0; i < m_caches.Length; i++) { m_caches[i].Initialize(); amount += m_caches[i].GetCacheSize(); } activeCachedObjects = new Hashtable(amount); }