private void PlaySFX(GameObject objectOfCollision) { //Debug.Log("Ball collides with " + collision.gameObject.tag); if (SFXPlayer && SFXPlayer.GetVolume() != 0f) { //print("Ball: PlaySFX: collision.tag: " + collision.gameObject.tag); switch (objectOfCollision.tag) { case "Unbreakable": SFXPlayer.PlayClip(unbreakableSound); break; case "Paddle": SFXPlayer.PlayClip(paddleSound); break; case "Wall": SFXPlayer.PlayClip(wallBounceSound); break; //case "LoseColider": AudioSource.PlayClipAtPoint(loseSound,transform.position, SFXPlayer.GetVolume()); break; default: { IPlayList B = objectOfCollision.GetComponent <Brick>(); if (B != null) { //print("Ball: PlaySFX: collision.gameObject is Brick class, PlayListID is: " + B.GetPlayListID().ToString()); SFXPlayer.PlayRandomSoundFromList(B.GetPlayListID()); } else { SFXPlayer.PlayRandomSoundFromList(SoundSystem.PlayListID.Brick); } }; break; } } }
private void PlaySFX(GameObject objectOfCollision) { //Debug.Log("Ball collides with " + collision.gameObject.tag); if (SFXPlayer && SFXPlayer.GetVolume() != 0f && hasStarted) { //print("Ball: PlaySFX: collision.tag: " + objectOfCollision.gameObject.tag); switch (objectOfCollision.tag) { case tags.UNBREAKABLE: SFXPlayer.PlayClipOnce(unbreakableSound); break; case tags.PADDLE: SFXPlayer.PlayClipOnce(paddleSound); break; case tags.WALL: SFXPlayer.PlayClipOnce(wallBounceSound); break; case tags.PICKUP:; break; default: { IPlayList B = objectOfCollision.GetComponent <IPlayList>(); if (B != null) { //print("Ball: PlaySFX: collision.gameObject is IPLayList class, PlayListID is: " + B.GetPlayListID().ToString()); SFXPlayer.PlayRandomSoundFromList(B.GetPlayListID()); } else { //print("Ball/PlaySFX: failed getting PlayListID, playing BrickSounds, after hitting object: " + objectOfCollision.name); SFXPlayer.PlayRandomSoundFromList(SoundSystem.PlayListID.Brick); }; break; } } } }