PowerTrainAniCtrl.cs 889 B

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