Пример #1
0
        protected override void OnShow(object userData)
        {
            base.OnShow(userData);
            m_PipeData = (PipeData)userData;

            //设置初始位置
            CachedTransform.SetLocalPositionX(10f);

            if (m_UpPipe == null || m_DownPipe == null)
            {
                m_UpPipe   = transform.Find("UpPipe");
                m_DownPipe = transform.Find("DownPipe");
            }

            //设置上下管道的偏移
            m_UpPipe.SetLocalPositionY(m_PipeData.OffsetUp);
            m_DownPipe.SetPositionY(m_PipeData.OffsetDown);

            //订阅事件
            GameEntry.Event.Subscribe(RestartEventArgs.EventId, OnRestart);
        }
 /// <summary>
 /// 显示管道实体
 /// </summary>
 public static void ShowPipe(this EntityComponent entityComponent, PipeData data)
 {
     entityComponent.ShowEntity(typeof(Pipe), "Pipe", data);
 }