示例#1
0
    public void Fire()
    {
        if (Time.time < firedLast + weaponData.GetFirerate())
        {
            return;
        }
        firedLast = Time.time;

        if (ammoCount <= 0)
        {
            Reload();
            // Play out of ammo in clip sound effect?
            return;
        }

        //       animator.SetTrigger("Shoot");

        audioSource.clip = weaponData.GetFireSound();
        audioSource.Play();

        ammoCount--;

        UIController.Instance.GetHUD().ChangeAmmo(ammoCount);

        GameObject bulletObject = ObjectPoolingManager.Instance.GetBullet();

        bulletObject.transform.position = shootPos.transform.position + shootPos.transform.forward;
        bulletObject.transform.forward  = shootPos.transform.forward;
    }