ObTrainAniCtrl.cs 853 B

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using GameFramework.Event;
  5. using UnityEngine;
  6. public class ObTrainAniCtrl : MonoBehaviour
  7. {
  8. public GameObject ani_1;
  9. public GameObject ani_2;
  10. void Start()
  11. {
  12. GameMain.Event.Subscribe(Ob_TrainAniEvent.EventId,OnGetAniEvent);
  13. }
  14. private void OnDestroy()
  15. {
  16. GameMain.Event.Unsubscribe(Ob_TrainAniEvent.EventId,OnGetAniEvent);
  17. }
  18. private void OnGetAniEvent(object sender, GameEventArgs e)
  19. {
  20. Ob_TrainAniEvent args = (Ob_TrainAniEvent)e;
  21. ani_1.SetActive(false);
  22. ani_2.SetActive(false);
  23. switch (args.type)
  24. {
  25. case 1:
  26. ani_1.SetActive(true);
  27. break;
  28. case 2:
  29. ani_2.SetActive(true);
  30. break;
  31. }
  32. }
  33. }