TopCard() public method

public TopCard ( ) : Card,
return Card,
Beispiel #1
0
    public IEnumerator AddToTable()
    {
        DealInProgress++;

        // Test for Face Card Slots
        if (_fc_slot1.AddCard(_stackCardSlot.TopCard()))
        {
            _fc_slot1.TopCard().status = GameState.Face;
            // Add to face list

            yield return(new WaitForSeconds(CardStackDelay));
        }
        if (_fc_slot2.AddCard(_stackCardSlot.TopCard()))
        {
            _fc_slot2.TopCard().status = GameState.Face;
            // Add to face list
            yield return(new WaitForSeconds(CardStackDelay));
        }
        if (_fc_slot3.AddCard(_stackCardSlot.TopCard()))
        {
            _fc_slot3.TopCard().status = GameState.Face;
            // Add to face list
            yield return(new WaitForSeconds(CardStackDelay));
        }
        if (_fc_slot4.AddCard(_stackCardSlot.TopCard()))
        {
            _fc_slot4.TopCard().status = GameState.Face;
            // Add to face list
            yield return(new WaitForSeconds(CardStackDelay));
        }

        DealInProgress--;
    }
    public IEnumerator DrawCoroutine()
    {
        DealInProgress++;

        //		if (_discardHoverStackCardSlot.AddCard(_prior6CardSlot.TopCard()))
        //		{
        //			yield return new WaitForSeconds(CardStackDelay);
        //		}
        //		if (_discardStackCardSlot.AddCard(_discardHoverStackCardSlot.TopCard()))
        //		{
        //			yield return new WaitForSeconds(CardStackDelay);
        //		}


        if (!cardCheveron2Lock && !cardCheveronCurrent)
        {
            _currentCardSlot.AddCard(_stackCardSlot.TopCard());
            cardCheveronCurrent = true;
//			}
        }

        if (!cardCheveron0Lock && cardCheveronCurrent)
        {
            if (_prior0CardSlot.AddCard(_currentCardSlot.TopCard()))
            {
                cardCheveron0Lock   = true;
                cardCheveronCurrent = false;
                yield return(new WaitForSeconds(CardStackDelay));
            }
        }
        if (cardCheveron0Lock && !cardCheveron1Lock && cardCheveronCurrent)
        {
            if (_prior1CardSlot.AddCard(_currentCardSlot.TopCard()))
            {
                cardCheveron1Lock   = true;
                cardCheveronCurrent = false;
                yield return(new WaitForSeconds(CardStackDelay));
            }
        }
        if (cardCheveron1Lock && !cardCheveron2Lock && cardCheveronCurrent)
        {
            if (_prior2CardSlot.AddCard(_currentCardSlot.TopCard()))
            {
                cardCheveron2Lock   = true;
                cardCheveronCurrent = false;
                yield return(new WaitForSeconds(CardStackDelay));
            }
        }
        //		int collectiveFaceValue = _prior0CardSlot.FaceValue();
        //		collectiveFaceValue += _prior1CardSlot.FaceValue();
        //		collectiveFaceValue += _prior2CardSlot.FaceValue();
        //		collectiveFaceValue += _prior3CardSlot.FaceValue();
        //		collectiveFaceValue += _prior4CardSlot.FaceValue();
        //		collectiveFaceValue += _prior5CardSlot.FaceValue();
        //		collectiveFaceValue += _prior6CardSlot.FaceValue();
        //		collectiveFaceValue += _currentCardSlot.FaceValue();
        Tarot3CardsDealerUIInstance.FaceValueText.text = _currentCardSlot.FaceValue();
        DealInProgress--;
    }
Beispiel #3
0
    /// Shuffle Coroutine.
    /// Moves all card to pickupCardSlot. Then shuffles them back
    /// to cardStackSlot.
    public IEnumerator ShuffleCoroutine()
    {
        DealInProgress++;
        foreach (CardSlot slot in GameObject.Find("AIHand").GetComponent <AIHand>().CardSlotList)
        {
            MoveCardSlotToCardSlot(slot, _centerStackCardSlot);
        }

        foreach (CardSlot slot in GameObject.Find("PlayerHand").GetComponent <PlayerHand>().CardSlotList)
        {
            //Disable glows
            if (slot.GetSize() > 0)
            {
                slot.TopCard().gameObject.transform.Find("Glow").gameObject.SetActive(false);
            }
            MoveCardSlotToCardSlot(slot, _centerStackCardSlot);
        }

        MoveCardSlotToCardSlot(_discardStackCardSlot, _centerStackCardSlot);
        MoveCardSlotToCardSlot(_drawStackCardSlot, _centerStackCardSlot);
        MoveCardSlotToCardSlot(_currentCardSlot, _centerStackCardSlot);
        yield return(new WaitForSeconds(.5f));

        MoveCardSlotToCardSlot(_centerStackCardSlot, _pickupCardSlot);
        yield return(new WaitForSeconds(.5f));

        int halfLength = _cardDeck.CardList.Count / 2;

        for (int i = 0; i < halfLength; ++i)
        {
            _leftHandCardSlot.AddCard(_pickupCardSlot.TopCard());
        }
        yield return(new WaitForSeconds(.2f));

        for (int i = 0; i < halfLength; ++i)
        {
            _rightHandCardSlot.AddCard(_pickupCardSlot.TopCard());
        }
        yield return(new WaitForSeconds(.2f));

        for (int i = 0; i < _cardDeck.CardList.Count; ++i)
        {
            if (i % 2 == 0)
            {
                _centerStackCardSlot.AddCard(_rightHandCardSlot.TopCard());
            }
            else
            {
                _centerStackCardSlot.AddCard(_leftHandCardSlot.TopCard());
            }
            yield return(new WaitForSeconds(CardStackDelay));
        }
        yield return(new WaitForSeconds(.3f));

        StartCoroutine(DealCards());
    }
Beispiel #4
0
    public IEnumerator DrawCoroutine()
    {
        DealInProgress++;

        if (_discardHoverStackCardSlot.AddCard(/*_prior4CardSlot*/ _prior3CardSlot.TopCard()))
        {
            yield return(new WaitForSeconds(CardStackDelay));
        }
        if (_discardStackCardSlot.AddCard(_discardHoverStackCardSlot.TopCard()))
        {
            yield return(new WaitForSeconds(CardStackDelay));
        }
        if (/*_prior4CardSlot*/ _discardHoverStackCardSlot.AddCard(_prior3CardSlot.TopCard()))
        {
            yield return(new WaitForSeconds(CardStackDelay));
        }
        if (_prior3CardSlot.AddCard(_prior2CardSlot.TopCard()))
        {
            yield return(new WaitForSeconds(CardStackDelay));
        }
        if (_prior2CardSlot.AddCard(_prior1CardSlot.TopCard()))
        {
            yield return(new WaitForSeconds(CardStackDelay));
        }
        if (_prior1CardSlot.AddCard(_prior0CardSlot.TopCard()))
        {
            yield return(new WaitForSeconds(CardStackDelay));
        }
        if (_prior0CardSlot.AddCard(_currentCardSlot.TopCard()))
        {
            yield return(new WaitForSeconds(CardStackDelay));
        }
        _currentCardSlot.AddCard(_stackCardSlot.TopCard());

        int collectiveFaceValue = _prior0CardSlot.FaceValue();

        collectiveFaceValue += _prior1CardSlot.FaceValue();
        collectiveFaceValue += _prior2CardSlot.FaceValue();
        collectiveFaceValue += _prior3CardSlot.FaceValue();
        //collectiveFaceValue += _prior4CardSlot.FaceValue();
        collectiveFaceValue += _currentCardSlot.FaceValue();
        DealerUIInstance.FaceValueText.text = collectiveFaceValue.ToString();

        DealInProgress--;
    }
Beispiel #5
0
    //Move all cards in a slot to another slot
    private void MoveCardSlotToCardSlot(CardSlot sourceCardSlot, CardSlot targetCardSlot)
    {
        Card card;

        while ((card = sourceCardSlot.TopCard()) != null)
        {
            targetCardSlot.AddCard(card);
        }
    }
Beispiel #6
0
    /// <summary>
    /// Shuffle Coroutine.
    /// Moves all card to pickupCardSlot. Then shuffles them back
    /// to cardStackSlot.
    /// </summary>
    public IEnumerator ShuffleCoroutine()
    {
        DealInProgress++;
        DealerUIInstance.FaceValueText.text = "0";
        MoveCardSlotToCardSlot(_stackCardSlot, _pickupCardSlot);
        MoveCardSlotToCardSlot(_prior0CardSlot, _pickupCardSlot);
        MoveCardSlotToCardSlot(_prior1CardSlot, _pickupCardSlot);
        MoveCardSlotToCardSlot(_prior2CardSlot, _pickupCardSlot);
        MoveCardSlotToCardSlot(_prior3CardSlot, _pickupCardSlot);
        //MoveCardSlotToCardSlot(_prior4CardSlot, _pickupCardSlot);
        MoveCardSlotToCardSlot(_discardStackCardSlot, _pickupCardSlot);
        MoveCardSlotToCardSlot(_currentCardSlot, _pickupCardSlot);
        yield return(new WaitForSeconds(.4f));

        int halfLength = _cardDeck.CardList.Count / 2;

        for (int i = 0; i < halfLength; ++i)
        {
            _leftHandCardSlot.AddCard(_pickupCardSlot.TopCard());
        }
        yield return(new WaitForSeconds(.2f));

        for (int i = 0; i < halfLength; ++i)
        {
            _rightHandCardSlot.AddCard(_pickupCardSlot.TopCard());
        }
        yield return(new WaitForSeconds(.2f));

        for (int i = 0; i < _cardDeck.CardList.Count; ++i)
        {
            if (i % 2 == 0)
            {
                _stackCardSlot.AddCard(_rightHandCardSlot.TopCard());
            }
            else
            {
                _stackCardSlot.AddCard(_leftHandCardSlot.TopCard());
            }
            yield return(new WaitForSeconds(CardStackDelay));
        }
        DealInProgress--;
    }
    /// <summary>
    /// Shuffle Coroutine.
    /// Moves all card to pickupCardSlot. Then shuffles them back
    /// to cardStackSlot.
    /// </summary>
    public IEnumerator ShuffleCoroutine()
    {
        DealInProgress++;

        yield return(StartCoroutine(GatherOthersCoroutine()));

        int halfLength = _pickupCardSlot.CardList.Count / 2;
        int fullLength = _pickupCardSlot.CardList.Count;

        for (int i = 0; i < halfLength; ++i)
        {
            _leftHandCardSlot.AddCard(_pickupCardSlot.TopCard());
        }
        yield return(new WaitForSeconds(.01f));

        for (int i = 0; i < halfLength; ++i)
        {
            _rightHandCardSlot.AddCard(_pickupCardSlot.TopCard());
        }
        yield return(new WaitForSeconds(.01f));

        _stackCardSlot.AddCard(_pickupCardSlot.TopCard());        //jic odd
        yield return(new WaitForSeconds(CardStackDelay));

        for (int i = 0; i < fullLength; ++i)
        {
            if (i % 2 == 0)
            {
                _stackCardSlot.AddCard(_rightHandCardSlot.TopCard());
            }
            else
            {
                _stackCardSlot.AddCard(_leftHandCardSlot.TopCard());
            }
            yield return(new WaitForSeconds(CardStackDelay));
        }
        //MoveCardSlotToCardSlot(_stackCardSlot, _pickupCardSlot);
        yield return(new WaitForSeconds(.01f));

        DealInProgress--;
    }
    void FlipCardSlotUp(CardSlot mCardSlot)
    {
        float      y   = mCardSlot.GetComponent <Transform>().rotation.eulerAngles.y;
        float      z   = mCardSlot.GetComponent <Transform>().rotation.eulerAngles.z;
        Quaternion rot = transform.localRotation;

        rot.eulerAngles = new Vector3(90f, y, z);
        Transform tTemp = mCardSlot.GetComponent <Transform> ();

        tTemp.rotation = rot;
        mCardSlot.TopCard().TargetTransform.rotation = rot;
    }
    public IEnumerator CutDeckCoroutine()
    {
        DealInProgress++;
        int halfLength   = _cardDeck.CardList.Count / 2;
        int thirdLength  = _cardDeck.CardList.Count / 3;
        int randomLength = Random.Range(thirdLength, halfLength);

        for (int i = 0; i < randomLength; ++i)
        {
            _leftHandCardSlot.AddCard(_stackCardSlot.TopCard());
        }
        yield return(new WaitForSeconds(.5f));

        for (int i = 0; i < (_cardDeck.CardList.Count - randomLength); ++i)
        {
            _rightHandCardSlot.AddCard(_stackCardSlot.TopCard());
        }

        yield return(new WaitForSeconds(.1f));

        for (int i = 0; i < randomLength; ++i)
        {
            _stackCardSlot.AddCard(_leftHandCardSlot.TopCard());
            yield return(new WaitForSeconds(CardStackDelay));
        }
        yield return(new WaitForSeconds(.5f));

        for (int i = 0; i < (_cardDeck.CardList.Count - randomLength); ++i)
        {
            _stackCardSlot.AddCard(_rightHandCardSlot.TopCard());
            yield return(new WaitForSeconds(CardStackDelay));
        }
        yield return(new WaitForSeconds(.01f));

//		MoveCardSlotToCardSlot(_stackCardSlot, _pickupCardSlot);
        yield return(new WaitForSeconds(.01f));

        DealInProgress--;
    }
Beispiel #10
0
    IEnumerator PlaceOnTable()
    {
        DealInProgress++;

        if (_fc_slot1.TopCard() == null)
        {
            _fc_slot1.AddCard(Manager.instance.Selected[0]);
        }
        else if (_fc_slot2.TopCard() == null)
        {
            _fc_slot2.AddCard(Manager.instance.Selected[0]);
        }
        else if (_fc_slot3.TopCard() == null)
        {
            _fc_slot3.AddCard(Manager.instance.Selected[0]);
        }
        else if (_fc_slot4.TopCard() == null)
        {
            _fc_slot4.AddCard(Manager.instance.Selected[0]);
        }
        else if (_fc_slot5.TopCard() == null)
        {
            _fc_slot5.AddCard(Manager.instance.Selected[0]);
        }
        else if (_fc_slot6.TopCard() == null)
        {
            _fc_slot6.AddCard(Manager.instance.Selected[0]);
        }
        else
        {
            // You cant place cards on the table
            yield return(null);
        }

        yield return(new WaitForSeconds(CardStackDelay));

        DealInProgress--;
    }
    void FlipCardSlotUp(CardSlot mCardSlot)
    {
        //float y = mCardSlot.GetComponent<Transform>().rotation.eulerAngles.y;
        int        number = Random.Range(0, 2);
        float      y      = number == 1?0f:-180f;
        float      z      = mCardSlot.GetComponent <Transform>().rotation.eulerAngles.z;
        Quaternion rot    = transform.localRotation;

        rot.eulerAngles = new Vector3(90f, y, z);
        Transform tTemp = mCardSlot.GetComponent <Transform> ();

        tTemp.rotation = rot;
        mCardSlot.TopCard().TargetTransform.rotation = rot;
    }
Beispiel #12
0
    public IEnumerator DealCards()
    {
        System.Random random = new System.Random();

        for (int i = 0; i < 10; i++)
        {
            int randomIndex = random.Next(0, _centerStackCardSlot.GetSize());
            _centerStackCardSlot.AddCard(_centerStackCardSlot.GetCard(randomIndex));
            GameObject.Find("PlayerHand").GetComponent <PlayerHand>().CardSlotList[i].AddCard(_centerStackCardSlot.TopCard());
            yield return(new WaitForSeconds(.05f));

            randomIndex = random.Next(0, _centerStackCardSlot.GetSize());
            _centerStackCardSlot.AddCard(_centerStackCardSlot.GetCard(randomIndex));
            GameObject.Find("AIHand").GetComponent <AIHand>().CardSlotList[i].AddCard(_centerStackCardSlot.TopCard());
            yield return(new WaitForSeconds(.05f));
        }

        MoveCardSlotToCardSlot(_centerStackCardSlot, _drawStackCardSlot);
        yield return(new WaitForSeconds(.3f));

        //Do a card flip after shuffle and dealing cards
        Card _cardTopFlip = _drawStackCardSlot.TopCard();

        _discardStackCardSlot.AddCard(_cardTopFlip);

        if (Match.instance.RoundCount == 0)
        {
            Match.instance.InitializeMatch();
        }
        else
        {
            Round.instance.InitializeRound();
        }

        DealInProgress--;
    }
    public IEnumerator DisplayCoroutine(CardSlot mCardSlot)
    {
        DealInProgress++;
        cardCheveronCurrent = true;

        if (_currentCardSlot.CardList.Count == 0)
        {
            if (mCardSlot == _prior0CardSlot)
            {
                float x = _prior0CardSlot.GetComponent <Transform>().rotation.eulerAngles.x;
                if (x == 270f)
                {
                    Debug.Log("x = " + x);
                    FlipCardSlotUp(_prior0CardSlot);
                    cardCheveronCurrent = false;
                }
                else
                {
                    _currentCardSlot.AddCard(mCardSlot.TopCard());
                    cardCheveron0Lock = false;
                }
            }
            if (mCardSlot == _prior1CardSlot)
            {
                float x = _prior1CardSlot.GetComponent <Transform>().rotation.eulerAngles.x;
                if (x == 270f)
                {
                    FlipCardSlotUp(_prior1CardSlot);
                    cardCheveronCurrent = false;
                }
                else
                {
                    _currentCardSlot.AddCard(mCardSlot.TopCard());
                    cardCheveron1Lock = false;
                }
            }
            if (mCardSlot == _prior2CardSlot)
            {
                float x = _prior2CardSlot.GetComponent <Transform> ().rotation.eulerAngles.x;
                if (x == 270f)
                {
                    FlipCardSlotUp(_prior2CardSlot);
                    cardCheveronCurrent = false;
                }
                else
                {
                    _currentCardSlot.AddCard(mCardSlot.TopCard());
                    cardCheveron2Lock = false;
                }
            }
            if (mCardSlot == _prior3CardSlot)
            {
                float x = _prior3CardSlot.GetComponent <Transform>().rotation.eulerAngles.x;
                if (x == 270f)
                {
                    FlipCardSlotUp(_prior3CardSlot);
                    cardCheveronCurrent = false;
                }
                else
                {
                    _currentCardSlot.AddCard(mCardSlot.TopCard());
                    cardCheveron3Lock = false;
                }
            }
            if (mCardSlot == _prior4CardSlot)
            {
                float x = _prior4CardSlot.GetComponent <Transform>().rotation.eulerAngles.x;
                if (x == 270f)
                {
                    FlipCardSlotUp(_prior4CardSlot);
                    cardCheveronCurrent = false;
                }
                else
                {
                    _currentCardSlot.AddCard(mCardSlot.TopCard());
                    cardCheveron4Lock = false;
                }
            }
            if (mCardSlot == _prior5CardSlot)
            {
                float x = _prior5CardSlot.GetComponent <Transform>().rotation.eulerAngles.x;
                if (x == 270f)
                {
                    FlipCardSlotUp(_prior5CardSlot);
                    cardCheveronCurrent = false;
                }
                else
                {
                    _currentCardSlot.AddCard(mCardSlot.TopCard());
                    cardCheveron5Lock = false;
                }
            }
            if (mCardSlot == _prior6CardSlot)
            {
                float x = _prior6CardSlot.GetComponent <Transform>().rotation.eulerAngles.x;
                if (x == 270f)
                {
                    FlipCardSlotUp(_prior6CardSlot);
                    cardCheveronCurrent = false;
                }
                else
                {
                    _currentCardSlot.AddCard(mCardSlot.TopCard());
                    cardCheveron6Lock = false;
                }
            }

            yield return(new WaitForSeconds(CardStackDelay));
        }
        //		int collectiveFaceValue = _prior0CardSlot.FaceValue();
        //		collectiveFaceValue += _prior1CardSlot.FaceValue();
        //		collectiveFaceValue += _prior2CardSlot.FaceValue();
        //		collectiveFaceValue += _prior3CardSlot.FaceValue();
        //		collectiveFaceValue += _prior4CardSlot.FaceValue();
        //		collectiveFaceValue += _prior5CardSlot.FaceValue();
        //		collectiveFaceValue += _prior6CardSlot.FaceValue();
        //		collectiveFaceValue += _currentCardSlot.FaceValue();
        TarotDealerUIInstance.FaceValueText.text = _currentCardSlot.FaceValue();
        DealInProgress--;
    }
    public IEnumerator DisplayCoroutine(CardSlot mCardSlot)
    {
        DealInProgress++;
        cardCheveronCurrent = true;

        if (_currentCardSlot.CardList.Count == 0)
        {
            if (mCardSlot == _prior0CardSlot)
            {
                cardCheveron0Lock = false;
                FlipCardSlotUp(_prior0CardSlot);
                _currentCardSlot.AddCard(mCardSlot.TopCard());
            }
            if (mCardSlot == _prior1CardSlot)
            {
                cardCheveron1Lock = false;
                FlipCardSlotUp(_prior1CardSlot);
                _currentCardSlot.AddCard(mCardSlot.TopCard());
            }
            if (mCardSlot == _prior2CardSlot)
            {
                cardCheveron2Lock = false;
                FlipCardSlotUp(_prior2CardSlot);
                _currentCardSlot.AddCard(mCardSlot.TopCard());
            }
            if (mCardSlot == _prior3CardSlot)
            {
                cardCheveron3Lock = false;
                FlipCardSlotUp(_prior3CardSlot);
                _currentCardSlot.AddCard(mCardSlot.TopCard());
            }
            if (mCardSlot == _prior4CardSlot)
            {
                cardCheveron4Lock = false;
                FlipCardSlotUp(_prior4CardSlot);
                _currentCardSlot.AddCard(mCardSlot.TopCard());
            }
            if (mCardSlot == _prior5CardSlot)
            {
                cardCheveron5Lock = false;
                FlipCardSlotUp(_prior5CardSlot);
                _currentCardSlot.AddCard(mCardSlot.TopCard());
            }
            if (mCardSlot == _prior6CardSlot)
            {
                cardCheveron6Lock = false;
                FlipCardSlotUp(_prior6CardSlot);
                _currentCardSlot.AddCard(mCardSlot.TopCard());
            }

            yield return(new WaitForSeconds(CardStackDelay));
        }
        //		int collectiveFaceValue = _prior0CardSlot.FaceValue();
        //		collectiveFaceValue += _prior1CardSlot.FaceValue();
        //		collectiveFaceValue += _prior2CardSlot.FaceValue();
        //		collectiveFaceValue += _prior3CardSlot.FaceValue();
        //		collectiveFaceValue += _prior4CardSlot.FaceValue();
        //		collectiveFaceValue += _prior5CardSlot.FaceValue();
        //		collectiveFaceValue += _prior6CardSlot.FaceValue();
        //		collectiveFaceValue += _currentCardSlot.FaceValue();
        TarotBasicDealerUIInstance.FaceValueText.text = _currentCardSlot.FaceValue();
        DealInProgress--;
    }
Beispiel #15
0
    public IEnumerator DrawCoroutine()
    {
        DealInProgress++;

        // First Card
        if (_p1_slot1.AddCard(_stackCardSlot.TopCard()))
        {
            _p1_slot1.TopCard().status = GameState.P1;
            // Add to p1 list
            yield return(new WaitForSeconds(CardStackDelay));
        }
        if (_p2_slot1.AddCard(_stackCardSlot.TopCard()))
        {
            _p2_slot1.TopCard().status = GameState.P2;
            // Add to p2 list
            yield return(new WaitForSeconds(CardStackDelay));
        }
        // Second Card
        if (_p1_slot2.AddCard(_stackCardSlot.TopCard()))
        {
            _p1_slot2.TopCard().status = GameState.P1;
            // Add to p1 list
            yield return(new WaitForSeconds(CardStackDelay));
        }
        if (_p2_slot2.AddCard(_stackCardSlot.TopCard()))
        {
            _p2_slot2.TopCard().status = GameState.P2;
            // Add to p2 list
            yield return(new WaitForSeconds(CardStackDelay));
        }
        // Third Card
        if (_p1_slot3.AddCard(_stackCardSlot.TopCard()))
        {
            _p1_slot3.TopCard().status = GameState.P1;
            // Add to p1 list
            yield return(new WaitForSeconds(CardStackDelay));
        }
        if (_p2_slot3.AddCard(_stackCardSlot.TopCard()))
        {
            _p2_slot3.TopCard().status = GameState.P2;
            // Add to p2 list
            yield return(new WaitForSeconds(CardStackDelay));
        }
        // Fourth Card
        if (_p1_slot4.AddCard(_stackCardSlot.TopCard()))
        {
            _p1_slot4.TopCard().status = GameState.P1;
            // Add to p1 list
            yield return(new WaitForSeconds(CardStackDelay));
        }
        if (_p2_slot4.AddCard(_stackCardSlot.TopCard()))
        {
            _p2_slot4.TopCard().status = GameState.P2;
            // Add to p2 list
            yield return(new WaitForSeconds(CardStackDelay));
        }
        // Fifth Card
        if (_p1_slot5.AddCard(_stackCardSlot.TopCard()))
        {
            _p1_slot5.TopCard().status = GameState.P1;
            // Add to p1 list
            yield return(new WaitForSeconds(CardStackDelay));
        }
        if (_p2_slot5.AddCard(_stackCardSlot.TopCard()))
        {
            _p2_slot5.TopCard().status = GameState.P2;
            // Add to p2 list
            yield return(new WaitForSeconds(CardStackDelay));
        }
        // Sixth Card
        if (_p1_slot6.AddCard(_stackCardSlot.TopCard()))
        {
            _p1_slot6.TopCard().status = GameState.P1;
            // Add to p1 list
            yield return(new WaitForSeconds(CardStackDelay));
        }
        if (_p2_slot6.AddCard(_stackCardSlot.TopCard()))
        {
            _p2_slot6.TopCard().status = GameState.P2;
            // Add to p2 list
            yield return(new WaitForSeconds(CardStackDelay));
        }

        /*
         * if (_fc_slot5.AddCard(_stackCardSlot.TopCard()))
         * {
         *  yield return new WaitForSeconds(CardStackDelay);
         * }
         * if (_fc_slot6.AddCard(_stackCardSlot.TopCard()))
         * {
         *  yield return new WaitForSeconds(CardStackDelay);
         * }
         */

        //if (_discardHoverStackCardSlot.AddCard(_p1_slot3.TopCard()))
        //{
        //    yield return new WaitForSeconds(CardStackDelay);
        //}
        //if (_discardStackCardSlot.AddCard(_discardHoverStackCardSlot.TopCard()))
        //{
        //    yield return new WaitForSeconds(CardStackDelay);
        //}
        //if (_p1_slot3.AddCard(_p2_slot3.TopCard()))
        //{
        //    yield return new WaitForSeconds(CardStackDelay);
        //}
        //if (_p2_slot3.AddCard(_p1_slot2.TopCard()))
        //{
        //    yield return new WaitForSeconds(CardStackDelay);
        //}
        //if (_p1_slot2.AddCard(_p2_slot2.TopCard()))
        //{
        //    yield return new WaitForSeconds(CardStackDelay);
        //}
        //if (_p2_slot2.AddCard(_p1_slot1.TopCard()))
        //{
        //    yield return new WaitForSeconds(CardStackDelay);
        //}
        //if (_p1_slot1.AddCard(_p2_slot1.TopCard()))
        //{
        //    yield return new WaitForSeconds(CardStackDelay);
        //}
        //_p2_slot1.AddCard(_stackCardSlot.TopCard());

        //int collectiveFaceValue = _p1_slot1.FaceValue();
        //collectiveFaceValue += _p2_slot2.FaceValue();
        //collectiveFaceValue += _p1_slot2.FaceValue();
        //collectiveFaceValue += _p2_slot3.FaceValue();
        //collectiveFaceValue += _p1_slot3.FaceValue();
        //collectiveFaceValue += _p2_slot1.FaceValue();
        //DealerUIInstance.FaceValueText.text = collectiveFaceValue.ToString();

        DealInProgress--;
    }
Beispiel #16
0
    /// <summary>
    /// Shuffle Coroutine.
    /// Moves all card to pickupCardSlot. Then shuffles them back
    /// to cardStackSlot.
    /// </summary>
    public IEnumerator ShuffleCoroutine()
    {
        DealInProgress++;

        //DealerUIInstance.FaceValueText.text = "0";
        //Debug.Log("Shuffling");
        //-------------------Amshu-------------------//
        // Change status of all cards
        Card[] cards = GameObject.FindObjectsOfType <Card>();
        foreach (Card card in cards)
        {
            card.status = GameState.Deck;
        }
        // Clear All Lists

        //-------------------------------------------//

        MoveCardSlotToCardSlot(_stackCardSlot, _pickupCardSlot);
        MoveCardSlotToCardSlot(_discardStackCardSlot, _pickupCardSlot);

        // Face Slots
        MoveCardSlotToCardSlot(_fc_slot1, _pickupCardSlot);
        MoveCardSlotToCardSlot(_fc_slot2, _pickupCardSlot);
        MoveCardSlotToCardSlot(_fc_slot3, _pickupCardSlot);
        MoveCardSlotToCardSlot(_fc_slot4, _pickupCardSlot);
        MoveCardSlotToCardSlot(_fc_slot5, _pickupCardSlot);
        MoveCardSlotToCardSlot(_fc_slot6, _pickupCardSlot);
        // Player 1 Slots
        MoveCardSlotToCardSlot(_p1_slot1, _pickupCardSlot);
        MoveCardSlotToCardSlot(_p1_slot2, _pickupCardSlot);
        MoveCardSlotToCardSlot(_p1_slot3, _pickupCardSlot);
        MoveCardSlotToCardSlot(_p1_slot4, _pickupCardSlot);
        MoveCardSlotToCardSlot(_p1_slot5, _pickupCardSlot);
        MoveCardSlotToCardSlot(_p1_slot6, _pickupCardSlot);
        // Player 2 Slots
        MoveCardSlotToCardSlot(_p2_slot1, _pickupCardSlot);
        MoveCardSlotToCardSlot(_p2_slot2, _pickupCardSlot);
        MoveCardSlotToCardSlot(_p2_slot3, _pickupCardSlot);
        MoveCardSlotToCardSlot(_p2_slot4, _pickupCardSlot);
        MoveCardSlotToCardSlot(_p2_slot5, _pickupCardSlot);
        MoveCardSlotToCardSlot(_p2_slot6, _pickupCardSlot);

        yield return(new WaitForSeconds(.4f));

        int halfLength = _cardDeck.CardList.Count / 2;

        for (int i = 0; i < halfLength; ++i)
        {
            _leftHandCardSlot.AddCard(_pickupCardSlot.TopCard());
        }
        yield return(new WaitForSeconds(.2f));

        for (int i = 0; i < halfLength; ++i)
        {
            _rightHandCardSlot.AddCard(_pickupCardSlot.TopCard());
        }

        SoundManager.instance.PlayClip(0);

        yield return(new WaitForSeconds(.2f));

        for (int i = 0; i < _cardDeck.CardList.Count; ++i)
        {
            if (i % 2 == 0)
            {
                _stackCardSlot.AddCard(_rightHandCardSlot.TopCard());
            }
            else
            {
                _stackCardSlot.AddCard(_leftHandCardSlot.TopCard());
            }
            yield return(new WaitForSeconds(CardStackDelay));
        }

        DealInProgress--;
    }