// Update is called once per frame
    void Update()
    {
        var packages = Net.doUpdate();

        foreach (var package in packages)
        {
            if (package.messageType == MessageType.SpawnPlayer)  //response
            {
                Match match = new Match();
                match         = Serializator.DeserializeMatch(package.data);
                this.match    = match;
                Net.myMatchID = match.matchID;
                for (int i = 0; i < this.match.matchPlayers.Count; i++)
                {
                    // if it is me, instantiate player color and set myGameID
                    if (this.match.matchPlayers[i].lobbyId == Net.myLobbyID)
                    {
                        players[i]    = Instantiate(playerTemplate, spawnPoints[i].transform.position, Quaternion.identity);
                        Net.myGameID  = this.match.matchPlayers[i].gameId;
                        myPlayerIndex = i;
                        info.text     = "My index: " + i + "ID: " + this.match.matchPlayers[i].gameId;
                    }
                    // else it is others
                    else
                    {
                        players[i] = Instantiate(opponentsTemplate, spawnPoints[i].transform.position, Quaternion.identity);
                    }
                }
            }
            else if (package.messageType == MessageType.OtherPlayerMoved)
            {
                float          step           = speed * Time.deltaTime;
                PlayerPosition playerPosition = new PlayerPosition();
                playerPosition = Serializator.DeserializePlayerPosition(package.data);

                // Movement in steps
                players[playerPosition.playerIndex].transform.position = Vector3.MoveTowards(players[playerPosition.playerIndex].transform.position, new Vector3(playerPosition.posX, playerPosition.posY, playerPosition.posZ), step);

                // Instant movement
                //players[playerPosition.playerIndex].transform.position = new Vector3(playerPosition.posX, playerPosition.posY, playerPosition.posZ);
            }
            else if (package.messageType == MessageType.ExitGame)
            {
                #if UNITY_EDITOR
                UnityEditor.EditorApplication.isPlaying = false;
                #else
                Application.Quit();
                #endif
            }
        }

        Moving();
    }