Пример #1
0
    // Inverts the column if the playerId is 2, otherwise returns the same value. Used when retrieving a value from the server which has been used in server processing.
    int ServerToClientColumn(byte playerId, int serverColumn)
    {
        if (playerId == ConnectFour.PLAYER_TWO)
        {
            return(ConnectFour.InvertColumn(serverColumn));
        }

        return(serverColumn);
    }
Пример #2
0
 // Converts a column of the playerId to a column in our space
 // Inverts the column if playerId is of the other player, otherwise returns the same value. This is used when we get the client coordinate of a player and have to convert it to our own.
 int ClientToLocalColumn(byte playerId, int clientColumn)
 {
     if (NetworkManager.IsMe(playerId))
     {
         return(clientColumn);
     }
     else
     {
         return(ConnectFour.InvertColumn(clientColumn));
     }
 }
Пример #3
0
 // Inverts the column, only if playerId is player 2. This is mostly use in Command functions, where we are sent a client coordinate and have to convert it to a server one
 int ClientToServerColumn(byte playerId, int clientColumn)
 {
     if (playerId == ConnectFour.PLAYER_TWO)
     {
         return(ConnectFour.InvertColumn(clientColumn));
     }
     else
     {
         return(clientColumn);
     }
 }