public void SendLocalMove(GamePiece.Piece piece, int boardX, int boardY) { string moveString = string.Format("{0}:{1}:{2}", piece.ToString(), boardX, boardY); Debug.Log("Sending move: " + moveString); var dict = new Dictionary <string, string>(); dict[PlatformManager.MyOculusID] = moveString; dict[m_remotePlayer.OculusID] = ""; Rooms.UpdateDataStore(m_matchRoom, dict).OnComplete(UpdateDataStoreCallback); TransitionToState(MatchRoomState.RemoteTurn); }
// called from the Matchmaking Manager when the remote users their next move public void MakeRemoteMove(GamePiece.Piece piece, int x, int y) { GameObject prefab = m_pieceA.PrefabFor(piece); if (piece == GamePiece.Piece.PowerBall) { m_board.AddPowerPiece(1, prefab, x, y); } else { m_board.AddPiece(1, prefab, x, y); } UpdateScores(); }
private void ProcessRemoteMove(string moveString) { Debug.Log("Processing remote move string: " + moveString); string[] tokens = moveString.Split(':'); GamePiece.Piece piece = (GamePiece.Piece)Enum.Parse(typeof(GamePiece.Piece), tokens[0]); int x = Int32.Parse(tokens[1]); int y = Int32.Parse(tokens[2]); // swap the coordinates since each player assumes they are player 0 x = GameBoard.LENGTH_X - 1 - x; y = GameBoard.LENGTH_Y - 1 - y; m_gameController.MakeRemoteMove(piece, x, y); }