Ejemplo n.º 1
0
    //Bullets.
    void FireWithAutomaticWeapon()
    {
        if (Time.time > nextFire && !reloadActive)
        {
            //Relaod Time
            nextFire = Time.time + (weaponStats.weaponReloadTime - weaponStats.weaponReloadTime * (atackSPeedBuff / 100));
            // get weapon stats
            int weaponBulletsInMagazine = weaponStats.weaponBulletsInMagazine;
            // if you have not WEAPON AMMO in magazine
            // reload mechanism
            if (weaponStats.weaponBulletsInMagazine <= 0)
            {
                weaponBulletsInMagazine = 0;
                float reloadTime = weaponStats.weaponMagazineReloadTime;
                StartCoroutine(Reload(reloadTime, curentWeapon));
            }

            // if you have ammo in magazine
            if (weaponBulletsInMagazine > 0)
            {
                StartCoroutine(weaponStats.FireProjective());
            }
        }
    }