CoolTrainAniCtrl.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using GameFramework.Event;
  5. using UnityEngine;
  6. public class CoolTrainAniCtrl : MonoBehaviour
  7. {
  8. public GameObject ani_1;
  9. public GameObject ani_2;
  10. public GameObject ani_3;
  11. public GameObject ani_4;
  12. public GameObject ani_5;
  13. void Start()
  14. {
  15. GameMain.Event.Subscribe(Cool_TrainAniEvent.EventId,OnGetAniEvent);
  16. }
  17. private void OnDestroy()
  18. {
  19. GameMain.Event.Unsubscribe(Cool_TrainAniEvent.EventId,OnGetAniEvent);
  20. }
  21. private void OnGetAniEvent(object sender, GameEventArgs e)
  22. {
  23. Cool_TrainAniEvent args = (Cool_TrainAniEvent)e;
  24. ani_1.SetActive(false);
  25. ani_2.SetActive(false);
  26. ani_3.SetActive(false);
  27. ani_4.SetActive(false);
  28. ani_5.SetActive(false);
  29. switch (args.type)
  30. {
  31. case 1:
  32. ani_1.SetActive(true);
  33. break;
  34. case 2:
  35. ani_2.SetActive(true);
  36. break;
  37. case 3:
  38. ani_3.SetActive(true);
  39. break;
  40. case 4:
  41. ani_4.SetActive(true);
  42. break;
  43. case 5:
  44. ani_5.SetActive(true);
  45. break;
  46. }
  47. }
  48. }