示例#1
0
        //Uppr canon fire
        private void rotateUpperCanon()
        {
            Collider[] colliders = Physics.OverlapSphere(transform.position, 25, 1 << enamyLayer);

            foreach (Collider collider in colliders)
            {
                if (collider.gameObject.layer == enamyLayer)
                {
                    Transform rootGameObject = collider.gameObject.transform.root;
                    Transform target         = rootGameObject.GetChild(0);

                    gunHelper.rotate(upperCanonMovingPart, target.transform, false);

                    if (Input.GetButtonDown("Fire3"))
                    {
                        playCanonMuzzleflash();
                        GameObject     canonBulletUpper = gunHelper.makeBullet(upperCanonBullet, upperCanonSpwonPosition);
                        CarCanonBullet carCanonBullet   = canonBulletUpper.GetComponent <CarCanonBullet>();

                        carCanonBullet.setTarget(target);
                    }
                    else
                    {
                        stopCanonMuzzleFlash();
                    }

                    break;
                }
            }
        }
示例#2
0
 private void shootCanon()
 {
     gunHelper.makeBullet(canonBullet, canonBulletSpwonPoint);
 }