Example #1
0
        public void ChangeBullet(GameObject newBullet)
        {
            BulletPrefab = newBullet;
            GenericObjectPool genericObjectPool = GenericObjectPool.Current;

            genericObjectPool.Init(BulletPrefab.GetHashCode(), behaviour =>
            {
                GameObject bullet = (GameObject)Instantiate(
                    BulletPrefab);

                IPoolAble poolAble = bullet.GetComponent <IPoolAble>();
                poolAble.Init(BulletPrefab.GetHashCode());
                return(poolAble);
            }, 20, 100);
        }
Example #2
0
        public override void Start()
        {
            InitWeaponHolder();

            GenericObjectPool genericObjectPool = GenericObjectPool.Current;

            genericObjectPool.Init(BulletPrefab.GetHashCode(), behaviour =>
            {
                GameObject bullet = (GameObject)Instantiate(
                    BulletPrefab);

                IPoolAble poolAble = bullet.GetComponent <IPoolAble>();
                poolAble.Init(BulletPrefab.GetHashCode());
                return(poolAble);
            }, 20, 100);
        }