예제 #1
0
        private void OnFireBullet()
        {
            //Override methods for Get() that allow for quick ways to set transform, rotations, etc
            //ExamplePooledBullet bullet = _bulletPooler?.Get();                                      //-- If you don't want to preset any pos/rot
            //ExamplePooledBullet bullet = _bulletPooler?.Get(transform.position);                    // -- If you want to preset pos, but not rot
            ExamplePooledBullet bullet = _bulletPooler?.Get(transform.position, transform.rotation);  // -- If you want to preset pos and rot

            //Make sure to do your sanity (null) check as it can return null if the pool stack is empty and you have a max pool count set.
            if (bullet != null)
            {
                _fireCooldown = _fireIntervalTimer;
                bullet.Fire();
            }
        }