Exemple #1
0
 public bool TryGetGameStateSelector(EStage_State _eState, out GuideState_GameState_Selector _selector)
 {
     for (int i = 0; i < GetChildCount(); ++i)
     {
         _selector = GetChild <GuideState_GameState_Selector>(i);
         if (_selector != null && _selector.SelectorGameState == _eState)
         {
             return(true);
         }
     }
     _selector = null;
     return(false);
 }
Exemple #2
0
        protected void InitGuideState()
        {
            ////////////////////////////////////////////////////////初始化引导状态行为树
            m_GuideStateRoot = new GuideState_Root();
            for (int i = 0; i < dicGuideStateConfigTable.Count; ++i)
            {
                SSchemeGuideStateData data = dicGuideStateConfigTable[i];
                if (data != null && data.GuideNodeIDList != null && data.GuideNodeIDList.Count > 0)
                {
                    GuideState_GameState_Selector gameStateSelector = null;
                    //判断已经有该状态类型
                    if (!m_GuideStateRoot.TryGetGameStateSelector(data.GameStateID, out gameStateSelector))
                    {//没有则增加
                        gameStateSelector = new GuideState_GameState_Selector(data.GameStateID);
                        m_GuideStateRoot.AddChild(gameStateSelector);
                    }

                    //判断是否已有该用户ID
                    GuideState_UserID_Selector userIDSelector = null;
                    if (!gameStateSelector.TryGetUserIDSelector(data.UserIDType, data.UserID, out userIDSelector))
                    {
                        userIDSelector = new GuideState_UserID_Selector(data.UserIDType, data.UserID);
                        gameStateSelector.AddChild(userIDSelector);
                    }

                    //挂接创建动态引导根节点逻辑
                    if (userIDSelector != null)
                    {
                        GuideState_CreateDynamicGuideLeaf dynamic = new GuideState_CreateDynamicGuideLeaf(data.GuideStateID);
                        dynamic.SetPrecondition(new TBTPreconditionAND(new CON_IsMainPlayerCreated(), new CON_IsPlayerLevelExit(data.PlayerLevelLimit)));
                        userIDSelector.AddChild(dynamic);
                    }
                }
            }

            m_guideData = new GuideWorkingData();
            m_guideData.GuideDynamicBB = new GuideBlackboard_EGuideBBKey();
            m_guideData.GuideStateBB   = new GuideBlackboard_EGuideStateBBKey();
            m_guideData.GuideStateBB.SetValue(EGuideStateBBKey.PlayerNoviceGuideType, ENNOVICEGUIDE_TYPE.ENNOVICEGUIDE_TYPE_GUIDE_TWOSTEP);
        }