Exemplo n.º 1
0
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                NetOutgoingMessage disconnectMsg = clientHandler.client.CreateMessage();
                disconnectMsg.Write("disconnected");
                disconnectMsg.Write(CLIENTUSERNAME);
                clientHandler.sendMessage(disconnectMsg, NetDeliveryMethod.ReliableOrdered);
                clientHandler.client.Shutdown("Bye server..");
                Exit();
            }
            float gTime = (float)gameTime.ElapsedGameTime.TotalSeconds;

            inputManager.readInput();

            clientHandler.update();

            entityHandler.tick(gTime);

            base.Update(gameTime);
        }