using System; using System.Collections; using System.Collections.Generic; using GameFramework.Event; using UnityEngine; public class NetTrainAniCtrl : MonoBehaviour { public GameObject ani_1; public GameObject ani_2; void Start() { GameMain.Event.Subscribe(Net_TrainAniEvent.EventId,OnGetAniEvent); } private void OnDestroy() { if (GameMain.Event.Check(Net_TrainAniEvent.EventId, OnGetAniEvent)) { GameMain.Event.Unsubscribe(Net_TrainAniEvent.EventId,OnGetAniEvent); } } private void OnGetAniEvent(object sender, GameEventArgs e) { Net_TrainAniEvent args = (Net_TrainAniEvent)e; switch (args.type) { case 1: ani_1.SetActive(true); ani_2.SetActive(false); break; case 2: ani_1.SetActive(false); ani_2.SetActive(true); break; } } }