public void AddNewCard(AbilityCard card) { AbilityCardView cardView = Instantiate(_cardViewPrefab, this.transform, false); _cardViews.Add(cardView); cardView.Setup(this, _deckStyleData); cardView.LoadNewCard(card); }
public HandItem(AbilityCardView cardView, Button button, int index, PlayerHandView handView) { CardView = cardView; ItemButton = button; Index = index; HandView = handView; Obj = cardView.gameObject; ItemButton.onClick.AddListener(() => { HandView.UseCard(Index); }); ColorBlock colors = button.colors; colors.highlightedColor = new Color(140, 140, 140); ItemButton.colors = colors; }
private void PrintEnemyHand() { int x = _eDisplayHand._size / _enemyHand.Count; for (int i = 0; i < _enemyHand.Count; i++) { Vector3 cardPos = new Vector3(75, 75, 75); GameObject eNewCard = Instantiate(_eCardPrefabUI, cardPos, Quaternion.identity); _eDisplayedHand.Add(eNewCard); _eDisplayedHand[i].transform.SetParent(_eDisplayHandObj.transform, false); _eDisplayedHand[i].transform.localScale = new Vector3(1f, 1f, 1f); _eDisplayedHand[i].transform.localPosition = new Vector3(-500 + (x * 2 * i), 0, 0); AbilityCardView newCardView = _eDisplayedHand[i].GetComponent <AbilityCardView>(); newCardView.Display(_enemyHand.GetCard(i)); Debug.Log("Player Hand Card: " + _enemyHand.GetCard(i).Name); } }
private void PrintPlayerHand() { int x = _displayHand._size / _playerHand.Count; for (int i = lastSize; i < _playerHand.Count; i++) { Vector3 cardPos = new Vector3(75, 75, 75); GameObject _newCard = Instantiate(_cardPrefabUI, cardPos, Quaternion.identity); _displayedHand.Add(_newCard); _displayedHand[i].transform.SetParent(_displayHandObj.transform, false); _displayedHand[i].transform.localScale = new Vector3(1f, 1f, 1f); _displayedHand[i].transform.localPosition = new Vector3(-500 + (x * 2 * i), 0, 0); AbilityCardView newCardView = _displayedHand[i].GetComponent <AbilityCardView>(); newCardView.Display(_playerHand.GetCard(i)); _displayedHand[i].name = i + " " + _playerHand.GetCard(i).Name; Debug.Log("Player Hand Card: " + _playerHand.GetCard(i).Name); } _displayHand.RenewList(); lastSize = _displayedHand.Count; UpdateHand(); }