Exemplo n.º 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);
        }
Exemplo n.º 2
0
 protected virtual void OnAllResourceCached()
 {
     m_render_world.OnUpdate(0);
     m_state            = CombatClientState.Loaded;
     m_state_frame_cnt  = 0;
     m_state_start_time = -1;
     m_last_update_time = -1;
 }
Exemplo n.º 3
0
 public virtual void StartCombat(int current_time_int)
 {
     m_state            = CombatClientState.Running;
     m_state_frame_cnt  = 0;
     m_state_start_time = current_time_int;
     m_last_update_time = 0;
     m_sync_client.Start(0, m_local_player_pstid, 200);
     if (Statistics.Instance != null)
     {
         Statistics.Instance.Enabled = true;
     }
 }
Exemplo n.º 4
0
 protected virtual void OnUpdateLoaded(int current_time_int)
 {
     if (m_state_frame_cnt == 0)
     {
         m_render_world.OnUpdate(0);
     }
     else if (m_state_frame_cnt == 1)
     {
         m_state            = CombatClientState.WaitingForStart;
         m_state_frame_cnt  = 0;
         m_state_start_time = current_time_int;
         m_last_update_time = current_time_int;
         ProcessReadyForStart();
     }
 }
Exemplo n.º 5
0
        protected void OnUpdateGameOver(int current_time_int)
        {
            m_sync_client.Stop();
            List <Command> commands = m_sync_client.GetOutputCommands();

            if (commands.Count > 0)
            {
                SendCommands(commands);
                m_sync_client.ClearOutputCommand();
            }
            m_state = CombatClientState.Ending;
            ProcessGameOver();
            if (Statistics.Instance != null)
            {
                Statistics.Instance.Enabled = false;
            }
        }
Exemplo n.º 6
0
 public virtual void OnGameOver(GameResult game_result)
 {
     m_state       = CombatClientState.GameOver;
     m_game_result = game_result;
 }