Beispiel #1
0
        /// <summary>
        /// 加载实体成功
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="gameEventArgs"></param>
        private void ShowEntitySuccess(object sender, GameEventArgs gameEventArgs)
        {
            var ne      = (ShowEntitySuccessEventArgs)gameEventArgs;
            var mapData = ne.UserData as MapData;

            if (mapData == null)
            {
                return;
            }

            CurrentMap = (Map)ne.Entity.Logic;
            CurrentMap.transform.position = m_MapPos;
            Log.Debug("加载地图成功 mapId" + mapData.Id);

            if (!GameEntry.Sound.CheckPlaying(m_BackgroundMusicId))
            {
                // 播放地图背景音乐
                GameEntry.Sound.PlayMusic(m_BackgroundMusicId);
            }

            // 设置地图事件 比如初始化角色位置 剧情等
            Rebana.GetPlayer().GetComponent <RebanaMovement>().Born(m_BornPos);
            Cliff.GetPlayer().GetComponent <CliffMovement>().Born(m_BornPos);
            Margaret.GetPlayer().GetComponent <MargaretMovement>().Born(m_BornPos);

            Cliff.GetPlayer().GetComponent <CliffMovement>().IsFollowing       = true;
            Margaret.GetPlayer().GetComponent <MargaretMovement>().IsFollowing = true;

            // 取消订阅事件
            GameEntry.Event.Unsubscribe(ShowEntitySuccessEventArgs.EventId, ShowEntitySuccess);
            GameEntry.Event.Unsubscribe(ShowEntityFailureEventArgs.EventId, ShowEntityFailure);

            // 派发事件
            GameEntry.Event.Fire(this, ReferencePool.Acquire <ChangeMapSuccessEventArgs>());
        }
Beispiel #2
0
 protected override void Start()
 {
     base.Start();
     FollowTarget = Cliff.GetPlayer().GetComponent <CliffMovement>();
 }