Exemplo n.º 1
0
    IEnumerator PlayerFireCoroutine(Ammo currentAmmo, int currentFireFlagIndex)
    {
        int currentFlagIndex = currentFireFlagIndex;

        try{
            /*pra garantir que a arma na struct baterá em ordem com a
             * arma em questao, passo o indice do vetor de booleanos, pois este
             * implicitamente define qual municao está sendo usada ( primeira, segunda etc...) */
            SelectFireType(currentAmmo, currentFireFlagIndex);
            //audioManager.play_shot_audio(8);
            ammosFireFlags[currentFlagIndex] = false;
        }
        catch (System.Exception e) {
            Debug.LogWarning(e);
        }
        if (WaitWaveDelay(currentFlagIndex))       //esperará um tempo especificado no container
        {
            yield return(new WaitForSeconds(ammoInfoContainer[currentFlagIndex].fireWaveDelay));
        }
        else        //esperará o delay da municao normalmente
        {
            yield return(new WaitForSeconds(currentAmmo.GetFireDelay()));
        }
        ammosFireFlags[currentFlagIndex] = true;
    }
Exemplo n.º 2
0
    IEnumerator PlayerFireCoroutine(Ammo currentAmmo, int currenFireFlagIndex)
    {
        int currentFlagIndex = currenFireFlagIndex;

        try{
            PlayerFire(currentAmmo);        //origensTiro);
            //audioManager.play_shot_audio(8);
            ammosFireFlags[currentFlagIndex] = false;
        }
        catch (System.Exception e) {
            Debug.LogWarning(e);
        }

        yield return(new WaitForSeconds(currentAmmo.GetFireDelay()));

        ammosFireFlags[currentFlagIndex] = true;
    }