예제 #1
0
        public void Update()
        {
            if (!active || disable)
            {
                return;
            }

            trans.LookAt(target.position);

            timer += Time.deltaTime;
            if (timer >= GameConstants.TURRET_SHOOT_INTERVAL)
            {
                timer = 0;

                audioSource.Play();
                for (int i = 0; i < muzzles.Length; i++)
                {
                    BulletControl b1 = pooling.GetBullet();
                    if (b1 != null)
                    {
                        b1.ApplyForce(muzzles[i].position, muzzles[i].forward);
                    }
                }
            }
        }
예제 #2
0
        public BulletControl GetBullet()
        {
            if (!bullets[currentBulletIndex].available)
            {
                return(null);
            }

            bullets[currentBulletIndex].available = false;

            BulletControl bc = bullets[currentBulletIndex];

            bc.Show();

            currentBulletIndex = (currentBulletIndex + 1) % bullets.Length;
            if (!bullets[currentBulletIndex].available)
            {
                Debug.LogError("ALIEN QUEEN BUG - Minimum Bullets depleted while trying to shoot");
            }

            return(bc);
        }