public void CreateBullet(BulletID id, Transform parent, Action <BulletController> onCreate)
        {
            BulletMaster master = SearchBulletMaster(id);

            EntityContainer <BulletController> container = _pooledBullets.GetContainer(id);
            BulletController bullet = TryGetPooledBullet(container);

            if (bullet == null)
            {
                var go = Instantiate(_bulletPrefab, parent);
                bullet = go.GetComponent <BulletController>();
            }

            bullet.SetMaster(master);
            container.Set(bullet);

            onCreate.SafeCall(bullet);
        }
 public void CreateBullet(BulletMaster master, Transform parent, Action <BulletController> onCreate)
 {
     CreateBullet(master.ID, parent, onCreate);
 }
Beispiel #3
0
        private void SetBullet(BulletMaster master)
        {
            Assert.IsNotNull(master);

            _bulletMaster = master;
        }
 public void SetMaster(BulletMaster master)
 {
     _master = master;
 }