Example #1
0
        public virtual void Initializa(long local_player_pstid, CombatStartInfo combat_start_info)
        {
            //真正的local_player_pstid在局外,传进来就好;combat_start_info是给所有玩家、观战者、以及录像回放时,都一致的消息
            m_local_player_pstid = local_player_pstid;
            m_level_data         = GetConfigProvider().GetLevelData(combat_start_info.m_level_id);
            m_state            = CombatClientState.Loading;
            m_state_frame_cnt  = 0;
            m_state_start_time = -1;
            m_last_update_time = -1;
            m_waiting_cnt      = 0;
#if UNITY_EDITOR
            m_is_first_frame = true;
#endif

            AttributeSystem.Instance.InitializeAllDefinition(m_combat_factory.GetConfigProvider());
            ComponentTypeRegistry.RegisterDefaultComponents();
            BehaviorTreeNodeTypeRegistry.RegisterDefaultNodes();
            DamageModifier.RegisterDefaultModifiers();
            m_combat_factory.RegisterCommands();

            BehaviorTreeFactory.Instance.SetConfigProvider(m_combat_factory.GetConfigProvider());

            m_logic_world = m_combat_factory.CreateLogicWorld();
            m_logic_world.Initialize(this, combat_start_info.m_world_seed, true);
            m_render_world = m_combat_factory.CreateRenderWorld();
            m_render_world.Initialize(this, m_logic_world);
            m_logic_world.SetIRenderWorld(m_render_world);
            m_sync_client = m_combat_factory.CreateSyncClient();
            m_sync_client.Init(m_logic_world);

            BuildLogicWorld(combat_start_info);
            BuildRenderWorld(m_level_data);
        }
        public void Initializa(long local_player_pstid)
        {
            m_local_player_pstid = local_player_pstid;
            m_state       = TestCombatClientState.Loading;
            m_waiting_cnt = 0;

            m_logic_world  = new TestLogicWorld(this, true);
            m_render_world = new TestRenderWorld(this, m_logic_world);
            m_sync_client  = new MNLPSyncClient();
            m_sync_client.Init(m_logic_world);

            ++m_waiting_cnt;
            m_render_world.LoadScene();
        }