Пример #1
0
    void PlayExplosionSFX(SFXStates SFXStates)
    {
        GameObject explosionPrefab = Instantiate(explosionsSFX);
        SFXPlayer  explosionPlayer = explosionPrefab.GetComponent <SFXPlayer>();

        explosionPlayer.PlaySFX(SFXStates);
    }
Пример #2
0
    void PlaySFX(SFXStates SFX)
    {
        GameObject clipGOInstance  = Instantiate(audioSFX);
        SFXPlayer  clipSFXInstance = clipGOInstance.GetComponent <SFXPlayer>();

        clipSFXInstance.PlaySFX(SFX);
    }
Пример #3
0
    public void PlaySFX(SFXStates whatToPlay)
    {
        switch (whatToPlay)
        {
        case SFXStates.Damage:
            damage.Play();
            break;

        case SFXStates.WaveCleared:
            waveCleared.Play();
            break;

        case SFXStates.teleport:
            teleport.Play();
            break;

        case SFXStates.SubExplosion:
            subExplosion.Play();
            break;

        case SFXStates.MainExplosion:
            mainExplosion.Play();
            break;

        case SFXStates.Laser:
            laser.Play();
            break;

        case SFXStates.PickUp:
            pickUp.Play();
            break;

        case SFXStates.PowerDown:
            powerDown.Play();
            break;

        case SFXStates.Asteroid:
            int randomNumber = Random.Range(0, explosionSFX.Length);
            explosionSFX[randomNumber].Play();
            break;

        default:
            Debug.LogError("This isn't supposed to happen! Code:SFX1");
            break;
        }
        StartCoroutine(DeleteGameObject());
    }