AppTrainAniCtrl.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using GameFramework.Event;
  5. using UnityEngine;
  6. using UnityEngine.Playables;
  7. using UnityEngine.Video;
  8. public class AppTrainAniCtrl : MonoBehaviour
  9. {
  10. public GameObject ani_1;
  11. public GameObject ani_2;
  12. public VideoPlayer player1;
  13. public VideoPlayer player2;
  14. void Start()
  15. {
  16. GameMain.Event.Subscribe(App_TrainAniEvent.EventId,OnGetAniEvent);
  17. }
  18. private void OnDestroy()
  19. {
  20. GameMain.Event.Unsubscribe(App_TrainAniEvent.EventId,OnGetAniEvent);
  21. }
  22. private void OnGetAniEvent(object sender, GameEventArgs e)
  23. {
  24. App_TrainAniEvent args = (App_TrainAniEvent)e;
  25. switch (args.type)
  26. {
  27. case 1:
  28. ani_1.SetActive(true);
  29. ani_2.SetActive(false);
  30. ani_1.GetComponent<PlayableDirector>().time = 0;
  31. // player1.Play();
  32. // player1.time = 0;
  33. // //player2.Stop();
  34. break;
  35. case 2:
  36. ani_1.SetActive(false);
  37. ani_2.SetActive(true);
  38. ani_2.GetComponent<PlayableDirector>().time = 0;
  39. // player2.Play();
  40. // player2.time = 0;
  41. // player1.Stop();
  42. break;
  43. }
  44. }
  45. }