コード例 #1
0
    public void Shoot()
    {
        if (!PlayerControl.crawl && !box_script.isCovered)
        {
            if (gun)
            {
                GunLaserScript gunControls = gun.GetComponent <GunLaserScript> ();
                gunControls.Shoot();
                Vector3    forward     = gun.transform.TransformDirection(Vector3.forward);
                int        ShotLength  = gunControls.ShotLength;
                int        RayStrength = gunControls.RayStrength;
                RaycastHit hit;

                if (Physics.Raycast(transform.position, forward, out hit, ShotLength))
                {
                    GunShot(gunControls, hit);
                }
            }
        }
    }
コード例 #2
0
        public void Shoot()
        {
            if (gun)
            {
                if (coolingDown <= 0)
                {
                    GunLaserScript gunControls = gun.GetComponent <GunLaserScript> ();
                    gunControls.Shoot();
                    Vector3    forward     = gun.transform.TransformDirection(Vector3.forward);
                    int        ShotLength  = gunControls.ShotLength;
                    int        RayStrength = gunControls.RayStrength;
                    RaycastHit hit;

                    if (Physics.Raycast(transform.position, forward, out hit, ShotLength))
                    {
                        GunShot(gunControls, hit);
                    }
                    coolingDown = gunCoolDown;
                }
            }
        }