Esempio n. 1
0
        public void OnUpdate(int current_time_int)
        {
            if (m_state != TestCombatServerState.Running)
            {
                return;
            }
            int current_time = current_time_int - m_start_time;
            int delta_ms     = current_time - m_last_update_time;

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

            if (commands.Count > 0)
            {
                NetworkMessages_SyncCommands msg = new NetworkMessages_SyncCommands();
                for (int i = 0; i < commands.Count; ++i)
                {
                    msg.AddCommand(commands[i]);
                }
                m_network.SendToClient(msg);
                m_sync_server.ClearOutputCommand();
            }
            m_last_update_time = current_time;
        }
Esempio n. 2
0
        public void OnUpdate(int current_time_int)
        {
            if (m_state != CombatServerState.Running)
            {
                return;
            }
            int current_time = current_time_int - m_start_time;
            int delta_ms     = current_time - m_last_update_time;

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

            if (commands.Count > 0)
            {
                SendCommands(commands);
                m_sync_server.ClearOutputCommand();
            }
            m_last_update_time = current_time;
        }