Beispiel #1
0
    public bool PullTrigger()
    {
        bool fired = false;

        if ((safetyOn == false) && ((fireRate == 0.0f) || (Time.time >= nextTimeToFire)) && (ammo.Remove(roundsPerShot) == roundsPerShot))
        {
            if (muzzleFlash != null)
            {
                muzzleFlash.Play();
            }
            Fire();
            fired = true;
            if (fireRate != 0.0f)
            {
                nextTimeToFire = Time.time + 1.0f / fireRate;
            }
        }
        return(fired);
    }