private void Initialize() { bulletType = BulletType.Default; bulletPool = GenericPool.CreateNewPool(this.transform, "BulletPool"); SetBulletPrefab(BulletType.Default); bulletSpawnTimer = Timer.InstantiateTimer(this.transform, "BulletTimer"); bulletSpawnTimer.SetOnCompleteCallback(ShootBullet); bulletSpawnTimer.RunTimer(bulletSpawnPeriod, true); }
private void InitBulletPool() { if (bulletPool == null) { bulletPool = GenericPool.CreateNewPool(this.transform, "BulletPool", 100); } Bullet bullet = CreateBulletPrefab(this.bulletType); bulletPool.SetPoolableObject(bullet, "Bullet", true); Destroy(bullet.gameObject); }