Exemple #1
0
    /// <summary>
    /// Method which plays the required sound fx
    /// </summary>
    /// <param name="fxType"></param>
    public void PlayFx(FxTypes fxType)
    {
        switch (fxType)                                 //switch case is used to run respective logic for respective FxType
        {
        case FxTypes.CANHIT:                            //if its CanHit
            fxSource.PlayOneShot(canHitFx);             //play canhit fx
            break;

        case FxTypes.GAMEOVER:                          //if its GAMEOVER
            fxSource.PlayOneShot(gameOverFx);           //play GAMEOVER fx
            break;

        case FxTypes.GAMEWIN:                           //if its GAMEWIN
            fxSource.PlayOneShot(gameWinFx);            //play GAMEWIN fx
            break;

        case FxTypes.BALLTHROW:
            fxSource.PlayOneShot(ballThrowFx);
            break;

        case FxTypes.BALLSPAWN:
            fxSource.PlayOneShot(ballSpawnFx);
            break;
        }
    }
    /// <summary>
    /// Method which plays the required sound fx
    /// </summary>
    public void PlayFx(FxTypes fxTypes)
    {
        switch (fxTypes)                                //switch case is used to run respective logic for respective FxType
        {
        case FxTypes.GAMEOVERFX:                        //if its GAMEOVER
            fxSource.PlayOneShot(gameOverFx);           //play GAMEOVER fx
            break;

        case FxTypes.GAMECOMPLETEFX:                    //if its GAMEWIN
            fxSource.PlayOneShot(gameCompleteFx);       //play GAMEWIN fx
            break;

        case FxTypes.SHOTFX:
            fxSource.PlayOneShot(shotFx);
            break;
        }
    }