ObjectClip.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using WebTools.SoundSystem.Datas;
  5. public class ObjectClip : MonoBehaviour {
  6. public AudioClip ObjectAudio;
  7. public SoundTypes.TypeAudio typeAudio;
  8. public bool active = false;
  9. private void Start()
  10. {
  11. if(!active)
  12. {
  13. if (ObjectAudio != null)
  14. {
  15. switch (typeAudio)
  16. {
  17. case SoundTypes.TypeAudio.FX:
  18. SoundManager.Instance.FXAudioPlay(ObjectAudio);
  19. active = true;
  20. break;
  21. case SoundTypes.TypeAudio.Ambient:
  22. SoundManager.Instance.AmbientAudioPlay(ObjectAudio);
  23. break;
  24. case SoundTypes.TypeAudio.UI:
  25. SoundManager.Instance.UIAudioPlay(ObjectAudio);
  26. break;
  27. case SoundTypes.TypeAudio.Music:
  28. SoundManager.Instance.MusicAudioPlay(ObjectAudio);
  29. break;
  30. }
  31. }
  32. }
  33. }
  34. }