コード例 #1
0
    private void Draw()
    {
        AbilityCard newCard = _abilityDeck.Draw(DeckPosition.Top);

        Debug.Log("Drew card: " + newCard.Name);
        _playerHand.Add(newCard, DeckPosition.Top);

        _abilityCardView.Display(newCard);
    }
コード例 #2
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.W))
        {
            PrintPlayerHand();
        }


        if (_playerHand.LastIndex == 0)
        {
            //if player is holding 1 card, show that card
            _handCard1.gameObject.SetActive(true);
            _handCard2.gameObject.SetActive(false);
            _handCard3.gameObject.SetActive(false);
            _abilityCardView1.Display(_playerHand.GetCard(_playerHand.LastIndex));
        }
        else if (_playerHand.LastIndex == 1)
        {
            //if player is holding 2 cards, show both cards
            _handCard1.gameObject.SetActive(true);
            _handCard2.gameObject.SetActive(true);
            _handCard3.gameObject.SetActive(false);

            _abilityCardView1.Display(_playerHand.GetCard(_playerHand.LastIndex));
            _abilityCardView2.Display(_playerHand.GetCard(_playerHand.LastIndex - 1));
        }
        else if (_playerHand.LastIndex == 2)
        {
            //if player is holding 3 cards, show all cards
            _handCard1.gameObject.SetActive(true);
            _handCard2.gameObject.SetActive(true);
            _handCard3.gameObject.SetActive(true);

            _abilityCardView1.Display(_playerHand.GetCard(_playerHand.LastIndex));
            _abilityCardView2.Display(_playerHand.GetCard(_playerHand.LastIndex - 1));
            _abilityCardView3.Display(_playerHand.GetCard(_playerHand.LastIndex - 2));
        }
    }
コード例 #3
0
    private void Draw()
    {
        AbilityCard newCard = _abilityDeck.Draw(DeckPosition.Top);

        Debug.Log("Drew card: " + newCard.Name);
        _playerHand.Add(newCard, DeckPosition.Top);

        _abilityCardView.Display(newCard);

        LeanTween.moveX(card, mainCard.transform.position.x, .3f).setLoopPingPong(1).setDelay(0.3f);
        drawSound.Play();

        if (_playerHand.Count == 0)
        {
            reShuffle();
        }
    }
コード例 #4
0
    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);
        }
    }
コード例 #5
0
/*    private void Update()
 *  {
 *      //replace me with enemy AI events
 *      int i = 0;
 *      if (i == 0)
 *      {
 *          Draw();
 *      }
 *      if (i == 0)
 *      {
 *          PrintEnemyHand();
 *      }
 *      if (i == 0)
 *      {
 *          PlayTopCard();
 *      }
 *  }*/

    public void Draw()
    {
        if (_enemyHand.Count < _maxCards)
        {
            for (int i = _maxCards - _enemyHand.Count; i < _maxCards; i++)
            {
                Draw();
            }
        }
        AbilityCard newCard = _enemyAbilityDeck.Draw(DeckPosition.Top);

        //Instantiate(newCard, new Vector3(i * 2.0F, 0, 0), Quaternion.identity);
        Debug.Log("Enemy drew card: " + newCard.Name);
        Debug.Log("Enemy has " + _enemyHand.Count + " cards.");
        _enemyHand.Add(newCard, DeckPosition.Top);

        //newCard._cardPosition = new Vector3();
        PrintEnemyHand();
        _enemyAbilityCardView.Display(newCard);
    }
コード例 #6
0
    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();
    }
コード例 #7
0
ファイル: DeckTester.cs プロジェクト: dan180000/TB-CardGame
    public void Draw()
    {
        if (TotalCards < Cardsets.Length)
        {
            AbilityCard newCard = abilityDeck.Draw(DeckPosition.Middle);
            Debug.Log("Drew card: " + newCard.Name);
            abilityCardView.Display(newCard);
            CardNumber += 1;
            TotalCards += 1;
        }
        for (int i = 0; i < Cardsets.Length; i++)
        {
            if (CardNumber < Cardsets.Length)
            {
                CardSet CS = Cardsets[CardNumber].gameObject.GetComponent(typeof(CardSet)) as CardSet;

                abilityCardView.costTextUI = CS.Cost;
                abilityCardView.graphicUI  = CS.image;
                abilityCardView.nameTextUI = CS.Name;

                Cardsets[CardNumber].SetActive(true);
            }
        }
    }