Example #1
0
        protected void OnUpdateRunning(int current_time_int)
        {
            current_time_int -= m_state_start_time;
            int delta_ms = current_time_int - m_last_update_time;

            if (delta_ms < 0)
            {
                return;
            }
#if UNITY_EDITOR
            if (m_is_first_frame)
            {
                m_is_first_frame = false;
                LogWrapper.LogInfo("CombatClient.OnUpdateRunning, first delta_ms = ", delta_ms);
            }
            if (delta_ms > 100)
            {
                LogWrapper.LogInfo("CombatClient.OnUpdateRunning, delta_ms = ", delta_ms);
            }
#endif
            m_sync_client.Update(current_time_int);
            m_render_world.OnUpdate(current_time_int);
            List <Command> commands = m_sync_client.GetOutputCommands();
            if (commands.Count > 0)
            {
                SendCommands(commands);
                m_sync_client.ClearOutputCommand();
            }
            m_last_update_time = current_time_int;
        }
        void OnUpdateRunning(int current_time_int)
        {
            current_time_int -= m_state_start_time;
            int delta_ms = current_time_int - m_last_update_time;

            if (delta_ms < 0)
            {
                return;
            }
            m_sync_client.Update(current_time_int);
            List <Command> commands = m_sync_client.GetOutputCommands();

            if (commands.Count > 0)
            {
                NetworkMessages_SyncCommands msg = new NetworkMessages_SyncCommands();
                msg.PlayerPstid = m_local_player_pstid;
                for (int i = 0; i < commands.Count; ++i)
                {
                    msg.AddCommand(commands[i]);
                }
                m_network.SendToServer(msg);
                m_sync_client.ClearOutputCommand();
            }
            m_render_world.OnUpdate(delta_ms, current_time_int);
            m_last_update_time = current_time_int;
        }