private void setDeadCard(GameObject card, cardLogic cl) { Debug.Log("set dead card working here"); card.GetComponent <Button>().interactable = false; var colorBlock = card.GetComponent <Button>().colors; colorBlock.disabledColor = Color.gray; cl.DeadImg.enabled = true; cl.startBlockPanel(); }
// Start is called before the first frame update void Start() { pv = GetComponent <PhotonView>(); _allPlayerManagers = new List <newPlayerManager>(); playersGameObjects = GameObject.FindGameObjectsWithTag("Player"); foreach (var p in playersGameObjects) { _allPlayerManagers.Add(p.GetComponent <newPlayerManager>()); var card = Instantiate(PlayerCardPrefab, Vector3.zero, Quaternion.identity, PlayesGrid); // var card = PhotonNetwork.Instantiate("PlayerVoteCard", new Vector3(0, 0, 0), Quaternion.identity); cardLogic cl = card.GetComponent <cardLogic>(); newPlayerManager pm = p.GetComponent <newPlayerManager>(); pm.voteManager = this; cl.characterImg.color = pm.myAvatarSprite.color; cl.ChaNameTxt.text = pm.playerNameText.text; cl.thisPlayer = pm; cl.VM = this; cl.BlockPanel = BlockPanel; cl.startBlockPanel(); pm.CardLogic = cl; if (pm.report) { cl.AlertImg.enabled = true; } allCardsList.Add(cl); // setting the right of vote if (pm.isDead) { setDeadCard(card, cl); } else { CanVoteNbr++; } } pv.RPC("cardsCountUpdate", RpcTarget.All); }