Exemple #1
0
        /// <summary>
        /// Instantiates a simple object pooler and sets it up
        /// </summary>
        protected virtual void InstantiateSimplePool()
        {
            if (PooledSimpleMMFloatingText == null)
            {
                Debug.LogError(this.name + " : no PooledSimpleMMFloatingText prefab has been set.");
                return;
            }
            GameObject newPooler = new GameObject();

            newPooler.name = PooledSimpleMMFloatingText.name + "_Pooler";
            newPooler.transform.SetParent(this.transform);
            MMSimpleObjectPooler simplePooler = newPooler.AddComponent <MMSimpleObjectPooler>();

            simplePooler.PoolSize              = PoolSize;
            simplePooler.GameObjectToPool      = PooledSimpleMMFloatingText.gameObject;
            simplePooler.NestWaitingPool       = NestWaitingPool;
            simplePooler.MutualizeWaitingPools = MutualizeWaitingPools;
            simplePooler.PoolCanExpand         = PoolCanExpand;
            simplePooler.FillObjectPool();
            _pooler = simplePooler;
        }
Exemple #2
0
        /// <summary>
        /// Instantiates a multiple object pooler and sets it up
        /// </summary>
        protected virtual void InstantiateMultiplePool()
        {
            GameObject newPooler = new GameObject();

            newPooler.name = this.name + "_Pooler";
            newPooler.transform.SetParent(this.transform);
            MMMultipleObjectPooler multiplePooler = newPooler.AddComponent <MMMultipleObjectPooler>();

            multiplePooler.Pool = new List <MMMultipleObjectPoolerObject>();
            foreach (MMFloatingText obj in PooledMultipleMMFloatingText)
            {
                MMMultipleObjectPoolerObject item = new MMMultipleObjectPoolerObject();
                item.GameObjectToPool = obj.gameObject;
                item.PoolCanExpand    = PoolCanExpand;
                item.PoolSize         = PoolSize;
                item.Enabled          = true;
                multiplePooler.Pool.Add(item);
            }
            multiplePooler.NestWaitingPool       = NestWaitingPool;
            multiplePooler.MutualizeWaitingPools = MutualizeWaitingPools;
            multiplePooler.FillObjectPool();
            _pooler = multiplePooler;
        }
Exemple #3
0
 /// <summary>
 /// On awake we fill our object pool
 /// </summary>
 protected virtual void Awake()
 {
     Instance = this;
     FillObjectPool();
 }