public bool UpdatePlayerGhost(MoveEvent moveItem)
 {
     if (moveItem.objectType == "Player" &&
         moveItem.uuid == networkManager.gameSession.uuidPlayer)
     {
         // Ghost is a variant of the regular player paddle.
         // There's just one pre-assigned ghost.
         PlayerControls pc = ghostPlayer.GetComponent <PlayerControls>();
         if (pc != null)
         {
             pc.setPosition(moveItem.position);
             pc.setVelocity(moveItem.velocity);
         }
     }
     return(true);
 }
        public void UpdateLocalGame(GameState serverGameState)
        {
            if (serverGameState.sequence == 0)
            {
                networkManager.gameSession.status = STATUS.INGAME;
            }

            GameState localGs = GatherGameState();

            // Resolve server versus local score:
            localGs.score1 = serverGameState.score1;
            localGs.score2 = serverGameState.score2;

            // Ball, just assume ball is fair, if close to server.
            BallControl bc   = theBall.GetComponent <BallControl>();
            Ball        ball = Ball.CopyBall(bc);
            /// Grab the first one...
            Ball serverBall = null;

            if (serverGameState.balls.Length > 0)
            {
                serverBall = serverGameState.balls[0];
                bool ballPositionOK = PositionInRange(ball.position, serverBall.position);
                bool ballVelocityOK = VelocityInRange(ball.velocity, serverBall.velocity);

                if (!ballPositionOK || !ballVelocityOK)
                {
                    // Blindly use server's ball position and velocity to resync. Better: Blend and rubber band.
                    bc.setPosition(serverBall.position);
                    bc.setVelocity(serverBall.velocity);
                }
            }
            else
            {
                // Perhaps a new game. No server info.
            }

            // Copy other paddle location(s) from server. Current player knows their own position.
            // TODO: need a map/ordered list.
            int cpIdx = -1; // current player
            int opIdx = -1; // other player

            Player[] serverPlayers = serverGameState.players;

            GameObject[] pcs = GameObject.FindGameObjectsWithTag("Player");
            foreach (GameObject p in pcs)
            {
                PlayerControls a = p.GetComponent <PlayerControls>();
                if (a.uuid == networkManager.gameSession.uuidOtherPlayer)
                {
                    // Find other player in server view:
                    for (var i = 0; i < serverGameState.players.Length; i++)
                    {
                        if (a.uuid == serverPlayers[i].uuid)
                        {
                            a.setPosition(serverPlayers[i].position);
                            if (a.uuid == networkManager.gameSession.uuidPlayer)
                            {
                                cpIdx = i;
                            }
                            else if (a.uuid == networkManager.gameSession.uuidOtherPlayer)
                            {
                                opIdx = i;
                            }
                        }
                    }
                }
            }


            // Player ghost. The position of where the server *thinks* the current player is.



            // Copy server score.
            // Merge/tweak ball position and velocity, we only care the ball state is fair.
            //   - Player position is ultimately sort of cosmetic.
            // Save to current GS.

            // Next update, gather and send that to server.

            return;
        }