Exemple #1
0
 private void OnEnable()
 {
     //if player interrupted the reload
     smgIsReloading = false;
     AmmoDisplayBroker.CallUpdateAmmoOnHud(bulletsInMagazine, smgMagazineSize);
     AmmoDisplayBroker.CallUpdateMagazinesOnHud(currentMagazineCount);
 }
Exemple #2
0
    private IEnumerator reloadRocket()
    {
        if (currentRockets > 0)
        {
            // Play Sound of rocket launcher reloading
            rocketSound.PlayOneShot(rocketReloadClip);

            //call brokers method weapon is reloading
            ReloadWeaponBroker.CallWeaponIsReloading();

            yield return(new WaitForSecondsRealtime(rocketReloadSpeed));

            currentRockets--;
            launcherIsReloading = false;
            rocketsInMagazine   = 1;

            //Update bullet and magazines count on HUD
            AmmoDisplayBroker.CallUpdateAmmoOnHud(rocketsInMagazine, rocketsInMagazine);
            AmmoDisplayBroker.CallUpdateMagazinesOnHud(currentRockets);
            AmmoDisplayBroker.CallUpdateMagazinesOnStore(weaponIndex, currentRockets);

            ReloadWeaponBroker.CallWeaponFinishedReloading();
        }
        else
        {
            Debug.Log("NO AMMO LEFT. RUN !!!");

            ReloadWeaponBroker.CallWeaponFinishedReloading();
            AmmoDisplayBroker.CallUpdateMagazinesOnStore(weaponIndex, currentRockets);
        }
    }
Exemple #3
0
    //Coroutine that reloads smg
    private IEnumerator ChangeMagazine()
    {
        if (currentMagazineCount > 0)
        {
            //call the method in the broker to invoke the reload event for the hud controller
            ReloadWeaponBroker.CallWeaponIsReloading();

            //Play Reload Sound
            smgSound.PlayOneShot(smgReloadClip);

            yield return(new WaitForSecondsRealtime(smgReloadSpeed));

            currentMagazineCount--;
            smgIsReloading    = false;
            bulletsInMagazine = 30;

            //Update bullet and magazine count on HUD
            AmmoDisplayBroker.CallUpdateAmmoOnHud(bulletsInMagazine, smgMagazineSize);
            AmmoDisplayBroker.CallUpdateMagazinesOnHud(currentMagazineCount);
            AmmoDisplayBroker.CallUpdateMagazinesOnStore(weaponIndex, currentMagazineCount);

            //  Debug.LogError("SMG RELOADED");

            ReloadWeaponBroker.CallWeaponFinishedReloading();
        }
        else
        {
            Debug.LogError("SMG OUT OF AMMO");

            ReloadWeaponBroker.CallWeaponFinishedReloading();
            AmmoDisplayBroker.CallUpdateMagazinesOnStore(weaponIndex, currentMagazineCount);
        }
    }
Exemple #4
0
    private IEnumerator ChangeMagazine()
    {
        if (currentMagazineCount > 0)
        {
            //Pistol reload SOUND
            pistolSound.PlayOneShot(pistolReloadClip);

            //Update the HUD to notify the player that the gun is reloading
            ReloadWeaponBroker.CallWeaponIsReloading();

            currentMagazineCount--;
            AmmoDisplayBroker.CallUpdateMagazinesOnStore(weaponIndex, currentMagazineCount);

            //Wait for reload time
            yield return(new WaitForSecondsRealtime(pistolReloadSpeed));

            pistolIsReloading = false;
            bulletsInMagazine = magazineSize;

            AmmoDisplayBroker.CallUpdateAmmoOnHud(bulletsInMagazine, magazineSize);
            AmmoDisplayBroker.CallUpdateMagazinesOnHud(currentMagazineCount);

            ReloadWeaponBroker.CallWeaponFinishedReloading();
        }
        else
        {
            Debug.Log("NO AMMO LEFT. RUN !!!");

            ReloadWeaponBroker.CallWeaponFinishedReloading();
            AmmoDisplayBroker.CallUpdateMagazinesOnStore(weaponIndex, currentMagazineCount);
        }
    }
Exemple #5
0
    // Start is called before the first frame update
    void Start()
    {
        rocketSound = GetComponent <AudioSource>();

        rocketsInMagazine = 1;
        //Update bullet count and total rockets on HUD
        AmmoDisplayBroker.CallUpdateAmmoOnHud(rocketsInMagazine, rocketsInMagazine);
        AmmoDisplayBroker.CallUpdateMagazinesOnHud(currentRockets);
    }
Exemple #6
0
    // Start is called before the first frame update
    void Start()
    {
        pistolSound = GetComponent <AudioSource>();

        bulletsInMagazine = magazineSize;

        //Update ammo and magazine count on HUD
        AmmoDisplayBroker.CallUpdateAmmoOnHud(bulletsInMagazine, magazineSize);
        AmmoDisplayBroker.CallUpdateMagazinesOnHud(currentMagazineCount);
        AmmoDisplayBroker.CallUpdateMagazinesOnStore(weaponIndex, currentMagazineCount);
    }
Exemple #7
0
    // Start is called before the first frame update
    void Start()
    {
        smgSound     = GetComponent <AudioSource>();
        lineRenderer = GetComponent <LineRenderer>();

        lineRenderer.SetPosition(1, firePoint.position);

        //set initial bullets in magazine
        bulletsInMagazine = smgMagazineSize;

        //Update bullet count on HUD
        AmmoDisplayBroker.CallUpdateAmmoOnHud(bulletsInMagazine, smgMagazineSize);
        AmmoDisplayBroker.CallUpdateMagazinesOnHud(currentMagazineCount);
    }
Exemple #8
0
    //?????????????  private Vector3 mouseAimLocation; need to apply AOE DAMAGE with the launcher



    private void OnEnable()
    {   //if player interrupted the reload this is a check to see if the gun had bullets inside
        launcherIsReloading = false;
        AmmoDisplayBroker.CallUpdateAmmoOnHud(rocketsInMagazine, rocketsInMagazine);
        AmmoDisplayBroker.CallUpdateMagazinesOnHud(currentRockets);
    }
Exemple #9
0
 private void OnEnable()
 {   //if player interrupted the reload this is a check to see if the gun had bullets inside the magazine.
     pistolIsReloading = false;
     AmmoDisplayBroker.CallUpdateAmmoOnHud(bulletsInMagazine, magazineSize);
     AmmoDisplayBroker.CallUpdateMagazinesOnHud(currentMagazineCount);
 }