예제 #1
0
 public Card(int val, Deck.Suit s)
 {
     value = val;
     suit  = s;
     id    = value + suit.ToString();
 }
예제 #2
0
    /// <summary>
    /// Component Start method.
    /// </summary>
    private void Start()
    {
        // Initializing the sorting order.

        bool heartsSortManaged   = false;
        bool diamondsSortManaged = false;
        bool clubsSortManaged    = false;
        bool spadesSortManaged   = false;

        while (!(heartsSortManaged && diamondsSortManaged && clubsSortManaged && spadesSortManaged))
        {
            int       tmpMinSortNumber = 5;
            Deck.Suit tmpMinSuit       = Deck.Suit.Hearts; // Only for initialization.

            // Finding the current minimum sorting value.
            if (!heartsSortManaged && heartsSortPosition < tmpMinSortNumber)
            {
                tmpMinSortNumber = heartsSortPosition;
                tmpMinSuit       = Deck.Suit.Hearts;
            }
            if (!diamondsSortManaged && diamondsSortPosition < tmpMinSortNumber)
            {
                tmpMinSortNumber = diamondsSortPosition;
                tmpMinSuit       = Deck.Suit.Diamonds;
            }
            if (!clubsSortManaged && clubsSortPosition < tmpMinSortNumber)
            {
                tmpMinSortNumber = clubsSortPosition;
                tmpMinSuit       = Deck.Suit.Clubs;
            }
            if (!spadesSortManaged && spadesSortPosition < tmpMinSortNumber)
            {
                tmpMinSortNumber = spadesSortPosition;
                tmpMinSuit       = Deck.Suit.Spades;
            }

            // Adding suit to the sorting list.
            suitOrder.Add(tmpMinSuit);

            // Checking which suit has been used.
            switch (tmpMinSuit)
            {
            case Deck.Suit.Hearts:
                heartsSortManaged = true;
                break;

            case Deck.Suit.Diamonds:
                diamondsSortManaged = true;
                break;

            case Deck.Suit.Clubs:
                clubsSortManaged = true;
                break;

            case Deck.Suit.Spades:
                spadesSortManaged = true;
                break;
            }
        }

        // Need to spawn the 52 cards.
        SpawnCards();
    }
예제 #3
0
 public Card(Deck.Suit suit1, Deck.FaceValue faceValue1)
 {
     this.suit1      = suit1;
     this.faceValue1 = faceValue1;
 }