public string switchComponentSoundEffects(ComponentSoundeffects incomingEnum) { string convertedString = ""; switch (incomingEnum) { case ComponentSoundeffects.SirensAlarm: convertedString = "Audio/Components/" + "SirensAlarm"; return(convertedString); case ComponentSoundeffects.buttonPressed: convertedString = "Audio/Components/" + "buttonPressed"; return(convertedString); case ComponentSoundeffects.crankPulled: convertedString = "Audio/Components/" + "crankPulled"; return(convertedString); } return(convertedString); }
public void setComponentSoundEffects(ComponentSoundeffects incomingEnum) { myAudioSource.clip = componentSoundEffectList[(int)incomingEnum]; myAudioSource.Play(); }