SoundManager.cs 757 B

123456789101112131415161718192021222324252627282930313233343536
  1. using UnityEngine;
  2. using System.Collections;
  3. public class SoundManager {
  4. private BackgroundSound _bgSound;
  5. public BackgroundSound bgSound
  6. {
  7. get{return _bgSound;}
  8. }
  9. private EffectSound _effectSound;
  10. public EffectSound effectSound
  11. {
  12. get{return _effectSound;}
  13. }
  14. public SoundManager()
  15. {
  16. _bgSound = (GameObject.Instantiate(Resources.Load("Prefabs/Sounds/BackgroundSound")) as GameObject)
  17. .GetComponent<BackgroundSound>();
  18. _effectSound = (GameObject.Instantiate(Resources.Load("Prefabs/Sounds/EffectSound")) as GameObject)
  19. .GetComponent<EffectSound>();
  20. }
  21. private static SoundManager instance;
  22. public static SoundManager GetInstatnce()
  23. {
  24. if(instance == null)
  25. {
  26. instance = new SoundManager();
  27. }
  28. return instance;
  29. }
  30. }