/// <summary> /// Changes the audio state of the customer /// </summary> /// <param name="state">The new audio state to change to</param> public void ChangeCustomerAudio(CustomerAudioStates state) { CurrentCustomerAudioState = state; if (CurrentCustomerAudioState == CustomerAudioStates.Stop) { audioSource.Stop(); } else { PlayCustomerAudio(state); } }
// plays the audio clip based on CurrentCustomerAudioState private void PlayCustomerAudio(CustomerAudioStates state) { audioSource.clip = customerAudioClips[(int)state]; audioSource.loop = state == CustomerAudioStates.Walking; audioSource.Play(); }