BYQ_Slider.cs 677 B

12345678910111213141516171819202122232425262728293031
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.Playables;
  5. using UnityEngine.UI;
  6. public class BYQ_Slider : MonoBehaviour
  7. {
  8. public PlayableDirector m_PlayableDirector;
  9. public Slider m_Slider;
  10. public Button m_PlayBtn;
  11. // Start is called before the first frame update
  12. void Start()
  13. {
  14. m_Slider.onValueChanged.AddListener(s =>
  15. {
  16. m_PlayableDirector.time = m_PlayableDirector.duration * s;
  17. });
  18. m_PlayBtn.onClick.AddListener(() =>
  19. {
  20. m_Slider.value = 0;
  21. });
  22. }
  23. // Update is called once per frame
  24. void Update()
  25. {
  26. }
  27. }