// 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); }
// 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)); } }
// 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); } }