Ejemplo n.º 1
0
    private void DebugInfo()
    {
        MLPoolBase <TestObjectItem> pool = MLPoolManager.Instance.GetPool <TestObjectItem>(POOL_ITEM_NAME);

        GUI.Label(new Rect(400, 10, 200, 32), "Object free num:" + pool.FreeObjectsCount
                  + " used num:" + pool.UsedObjectsCount, labStyle);
        for (int i = 0; i < liveObjects.Count; i++)
        {
            TestObjectItem item = liveObjects[i];
            GUI.Label(new Rect(200, 50 + i * 40, 200, 32), "Name:" + item.name + " num:" + item.num, labStyle);
        }
    }
Ejemplo n.º 2
0
    private void DespawnObject()
    {
        if (liveObjects.Count <= 0)
        {
            return;
        }

        TestObjectItem terryTrans = liveObjects[liveObjects.Count - 1];

        poolMgr.Despawn <TestObjectItem>(POOL_ITEM_NAME, terryTrans);
        liveObjects.Remove(terryTrans);
    }
Ejemplo n.º 3
0
    private void SpawnObject()
    {
        TestObjectItem objectItem = poolMgr.Spawn <TestObjectItem>(POOL_ITEM_NAME);

        if (objectItem == null)
        {
            Debug.LogWarning("Can't spawn object item!!");
            return;
        }

        int itemNum = 0;

        if (liveObjects.Count != 0)
        {
            TestObjectItem item = liveObjects[liveObjects.Count - 1];
            itemNum = item.num + 1;
        }

        objectItem.name = "objectItem" + itemNum;
        objectItem.num  = itemNum;

        liveObjects.Add(objectItem);
    }