示例#1
0
 private void CheckBounds()
 {
     if (transform.position.y >= boundary.Top)
     {
         //TODO: This code needs to change to use the BulletPoolManager's
         //TODO: ResetBullet function which will return the bullet to the pool
         BulletPoolManager.GetInstance().ResetBullet(bulletType, this.gameObject);
     }
 }
示例#2
0
    IEnumerator FireBullet()
    {
        while (true)
        {
            // Check every 0.2 seconds if shoot button is pressed
            yield return(new WaitForSeconds(0.15f));

            if (isFiring)
            {
                _bulletSound.Play();

                //TODO: this code needs to change to user the BulletPoolManager's
                //TODO: GetBullet function which will return a reference to a
                //TODO: bullet object.
                //TODO: Ensure you position the new bullet at the bulletSpawn position
                BulletPoolManager.GetInstance().GetBullet(bulletSpawn.position);
            }
        }
    }
示例#3
0
    IEnumerator FireBullet()
    {
        while (true)
        {
            // Check every 0.2 seconds if shoot button is pressed
            yield return(new WaitForSeconds(0.15f));

            if (isFiring)
            {
                _bulletSound.Play();

                //TODO: this code needs to change to user the BulletPoolManager's
                //TODO: GetBullet function which will return a reference to a
                //TODO: bullet object.
                //TODO: Ensure you position the new bullet at the bulletSpawn position
                GameObject bullet = BulletPoolManager.GetInstance().GetBullet(bulletType);
                bullet.SetActive(true);

                bullet.GetComponent <BulletController>().bulletType = bulletType;

                bullet.transform.position = bulletSpawn.position;
            }
        }
    }