示例#1
0
        public Deck()
        {
            kartas = new Karta[36];
            int i = 0;

            for (; i < 36; i++)
            {
                kartas[i] = new Karta();
            }

            i = 0;

            for (; i < 4; i++)
            {
                kartas[i].lear = Lear.six;
            }

            for (; i < 8; i++)
            {
                kartas[i].lear = Lear.seven;
            }

            for (; i < 12; i++)
            {
                kartas[i].lear = Lear.eight;
            }

            for (; i < 16; i++)
            {
                kartas[i].lear = Lear.nine;
            }

            for (; i < 20; i++)
            {
                kartas[i].lear = Lear.ten;
            }

            for (; i < 24; i++)
            {
                kartas[i].lear = Lear.man;
            }

            for (; i < 28; i++)
            {
                kartas[i].lear = Lear.woman;
            }

            for (; i < 32; i++)
            {
                kartas[i].lear = Lear.king;
            }

            for (; i < 36; i++)
            {
                kartas[i].lear = Lear.ace;
            }
        }
示例#2
0
        public void MixDeck()
        {
            Karta[] kartas2 = new Karta[kartas.Length];
            Random  rand    = new Random();

            for (int i = 0; i < kartas2.Length; i++)
            {
                int randomNumber = rand.Next(0, kartas.Length - 1);
                kartas2[i] = kartas[randomNumber];
                var copy = kartas.ToList();
                copy.RemoveAt(randomNumber);
                kartas = copy.ToArray();
            }
            kartas = kartas2;
        }
示例#3
0
 public void TakeOneKart(Karta karta)
 {
     Array.Resize(ref kartas, kartas.Length + 1);
     kartas[kartas.Length - 1] = new Karta();
     kartas[kartas.Length - 1] = karta;
 }