SoundtrackTrigger.cs 825 B

1234567891011121314151617181920212223242526272829303132333435
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using Sirenix.OdinInspector;
  5. namespace KairoEngine.SoundtrackSystem
  6. {
  7. public class SoundtrackTrigger : MonoBehaviour
  8. {
  9. public Soundtrack soundtrack;
  10. public bool playOnStart = true;
  11. public bool endOnSceneChange = true;
  12. [ShowIf("@hasLayers()")] public string playLayer = "";
  13. private bool hasLayers()
  14. {
  15. if(soundtrack != null)
  16. {
  17. if(soundtrack.soundtrackType == SoundtrackType.Layered) return true;
  18. }
  19. return false;
  20. }
  21. void Start()
  22. {
  23. if(playOnStart)
  24. {
  25. // changed this....
  26. SoundtrackManager.PlayTrack(soundtrack);
  27. }
  28. }
  29. }
  30. }