예제 #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;
                }
            }
        }