public void RenderPlays(PlayData p) { string userId = FindPlayerIdByIndex(turn); if (userId != "") { GameObject obj = GameObject.Find(userId); UserController status = obj.GetComponent <UserController>(); status.isActive = false; } OnClickCard(""); // Update the current row's topcard status if (p.action == MessageHandler.PLAY) { if (lastTopCard != "") { GameObject last = GameObject.Find(lastTopCard); CardController lastCard = last.GetComponent <CardController>(); lastCard.lost = true; } lastTopCard = p.card; } // Current player's play if (p.index == player.index) { player.cards.Remove(p.card); player.numCard--; GameObject obj = GameObject.Find(p.card); CardController cardController = obj.GetComponent <CardController>(); int pos = 5 - player.numCard; float xOffset = -0.7f + (0.4f * pos); Vector3 targetPos = Vector3.zero; Vector3 targetScale = Vector3.zero; int order = 1; if (p.row < 4) { order = pos + 1; targetPos = new Vector3(playView[0].transform.position.x + xOffset, playView[0].transform.position.y, playView[0].transform.position.z); targetScale = new Vector3(obj.transform.localScale.x * 0.8f, obj.transform.localScale.y * 0.8f, obj.transform.localScale.z); } else if (p.row == 4) { order = 10; targetPos = new Vector3(playerView.transform.position.x, playerView.transform.position.y, playerView.transform.position.z); } else { order = 9; targetPos = new Vector3(playerView.transform.position.x - 0.6f, playerView.transform.position.y, playerView.transform.position.z); } cardController.Action(p.action, p.row, order, targetPos, targetScale); if (p.row < 4) { xOffset = -1.3f * (player.cards.Count - 1) / 2; for (int i = 0; i < player.cards.Count; i++) { GameObject otherCard = GameObject.Find(player.cards[i]); cardController = otherCard.GetComponent <CardController>(); cardController.targetPos = new Vector3(playerView.transform.position.x + xOffset, playerView.transform.position.y, playerView.transform.position.z); xOffset += 1.5f; } } if (p.row == 4) { GameObject otherCard = GameObject.Find(player.cards[0]); cardController = otherCard.GetComponent <CardController>(); cardController.targetPos = new Vector3(playerView.transform.position.x, playerView.transform.position.y, playerView.transform.position.z); cardController.sortingOrder = 1; } } else { foreach (var player in otherPlayers) { if (p.index == player.index) { player.numCard--; int index = player.mappedIndex; GameObject newCard = Instantiate(playerCard); newCard.name = p.card; CardController cardController = newCard.GetComponent <CardController>(); if (p.row < 4) { newCard.transform.position = new Vector3(otherCard[index].transform.position.x, otherCard[index].transform.position.y, otherCard[index].transform.position.z); newCard.transform.localScale = new Vector3(newCard.transform.localScale.x * 0.6f, newCard.transform.localScale.y * 0.6f, newCard.transform.localScale.z); } else if (p.row == 4) { newCard.transform.position = new Vector3(otherCard[index].transform.position.x, otherCard[index].transform.position.y, otherCard[index].transform.position.z); newCard.transform.localScale = new Vector3(newCard.transform.localScale.x * 0.6f, newCard.transform.localScale.y * 0.6f, newCard.transform.localScale.z); } else { newCard.transform.position = new Vector3(playView[index].transform.position.x, playView[index].transform.position.y, playView[index].transform.position.z); newCard.transform.localScale = new Vector3(newCard.transform.localScale.x, newCard.transform.localScale.y, newCard.transform.localScale.z); } Vector3 targetPos = Vector3.zero; Vector3 targetScale = Vector3.zero; int order = 0; if (p.row < 4) { int pos = 5 - player.numCard; float xOffset = -0.7f + (0.4f * pos); order = pos + 1; targetPos = new Vector3(playView[index].transform.position.x + xOffset, playView[index].transform.position.y, playView[index].transform.position.z); targetScale = new Vector3(newCard.transform.localScale.x * 1.34f, newCard.transform.localScale.y * 1.34f, newCard.transform.localScale.z); } else if (p.row == 4) { order = 10; targetPos = new Vector3(playView[index].transform.position.x, playView[index].transform.position.y, playView[index].transform.position.z); targetScale = new Vector3(newCard.transform.localScale.x * 1.67f, newCard.transform.localScale.y * 1.67f, newCard.transform.localScale.z); } else { order = 9; targetPos = new Vector3(playView[index].transform.position.x - 0.5f, playView[index].transform.position.y, playView[index].transform.position.z); } cardController.Action(p.action, p.row, order, targetPos, targetScale); } } } if (p.newRow) { row = p.row + 1; lastTopCard = ""; } else { row = p.row; } turn = p.nextTurn; string newUserId = FindPlayerIdByIndex(turn); if (p.row < 5 && newUserId != "") { GameObject obj = GameObject.Find(newUserId); UserController status = obj.GetComponent <UserController>(); status.isActive = true; } if ((p.row == 4 && p.newRow == true && turn == player.index) || (p.row == 5 && turn == player.index)) { StartCoroutine(PlayLastCard()); } else if (turn == player.index) { moveTimeout = false; } }