You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

33 line
686 B

  1. using System;
  2. using SUISS.Core;
  3. public class CIGSoundOnIslandVisit : CIGSoundOnEvent
  4. {
  5. protected override void Start()
  6. {
  7. base.Start();
  8. SingletonMonobehaviour<WorldMap>.Instance.VisibilityChangedEvent += this.OnWorldMapVisibility;
  9. if (!SingletonMonobehaviour<WorldMap>.Instance.IsVisible)
  10. {
  11. base.PlaySound();
  12. }
  13. }
  14. protected override void OnDestroy()
  15. {
  16. base.OnDestroy();
  17. if (SingletonMonobehaviour<WorldMap>.IsAvailable)
  18. {
  19. SingletonMonobehaviour<WorldMap>.Instance.VisibilityChangedEvent -= this.OnWorldMapVisibility;
  20. }
  21. }
  22. private void OnWorldMapVisibility(bool visible)
  23. {
  24. if (!visible)
  25. {
  26. base.PlaySound();
  27. }
  28. }
  29. }