コード例 #1
0
        public void UpdateWorld(float DeltaTime)
        {
            //Poll User Input from the server window
            ProcessInput(ApplicationWindow.Focused, DeltaTime);

            //Manage all client connections and their player characters
            ConnectionManager.CheckClients(DeltaTime);
            ConnectionManager.CleanDeadClients(World);
            ConnectionManager.AddNewClients(World);
            ConnectionManager.UpdateClientPositions(World);
            ConnectionManager.RespawnDeadPlayers(World);

            //Track current inhabitants of the PVP Battle Arena, then process the players PVP attacks
            List <CharacterData> InGameCharacters = ClientSubsetFinder.GetInGameCharacters();

            PVPBattleArena.UpdateArenaInhabitants(InGameCharacters);
            PVPBattleArena.AlertTravellers();
            ConnectionManager.PerformPlayerAttacks(World);

            //Update the packet queue, transmitting all messages to the client connections
            PacketQueue.UpdateQueue(DeltaTime, TransmitPackets);

            //Update the physics simulation
            World.Timestep(DeltaTime, ThreadDispatcher);
            TimeSamples.RecordFrame(World);
        }
コード例 #2
0
 void Update()
 {
     //Wait for server connection to be established until it times out
     if (TryingToConnect)
     {
         TryConnecting();
     }
     //Setup the server connection when it connects successfully
     else if (ConnectionEstablished && !IsConnected)
     {
         SetupNewConnection();
     }
     //Handle Packets from server, and send out our packets in intervals when the connection is open
     else
     {
         //Process instructions sent from the game server
         HandleEvents();
         //Send out any queued packets each timestep that passes
         PacketQueue.UpdateQueue(TransmitPackets);
     }
 }