Ejemplo n.º 1
0
        private void ShuffleDecks()
        {
            Random random = new Random(Guid.NewGuid().GetHashCode());

            List <Card> newDeck1 = new List <Card>();
            List <Card> newDeck2 = new List <Card>();
            List <Card> newDeck3 = new List <Card>();

            int deck1Size = Deck1.Count;
            int deck2Size = Deck2.Count;
            int deck3Size = Deck3.Count;

            for (int i = 0; i < deck1Size; i++)
            {
                int max = deck1Size - (i + 1);
                max = ((max == -1)? 0 : max);

                int index = random.Next(0, max);
                newDeck1.Add(Deck1[index]);
                Deck1.RemoveAt(index);
            }

            Deck1 = newDeck1;

            for (int i = 0; i < deck2Size; i++)
            {
                int max = deck2Size - (i + 1);
                max = ((max == -1) ? 0 : max);

                int index = random.Next(0, max);
                newDeck2.Add(Deck2[index]);
                Deck2.RemoveAt(index);
            }

            Deck2 = newDeck2;

            for (int i = 0; i < deck3Size; i++)
            {
                int max = deck3Size - (i + 1);
                max = ((max == -1) ? 0 : max);

                int index = random.Next(0, max);
                newDeck3.Add(Deck3[index]);
                Deck3.RemoveAt(index);
            }

            Deck3 = newDeck3;
        }
Ejemplo n.º 2
0
        public void InicializarObjetos()
        {
            _ninjaHub.Connect();
            _ninjaHub.OnPlayer1MovimentaDireita  += NinjaHub_OnPlayer1MovimentaDireita;
            _ninjaHub.OnPlayer1MovimentaEsquerda += NinjaHub_OnPlayer1MovimentaEsquerda;
            _ninjaHub.OnPlayer2MovimentaDireita  += NinjaHub_OnPlayer2MovimentaDireita;
            _ninjaHub.OnPlayer2MovimentaEsquerda += NinjaHub_OnPlayer2MovimentaEsquerda;
            // tela de escolher os personagens
            Ninja1 = new NinjaVerde(this, _priteBatch, _ninjaHub);
            Ninja1.InicializarPlayer1();
            Ninja1.Initialize();

            Ninja2 = new NinjaRoxo(this, _priteBatch, _ninjaHub);
            Ninja2.InicializarPlayer2();
            Ninja2.Initialize();
            Ninja2.VirarEsquerda();
            //inicialização dos Decks
            Deck1 = new Deck1(this, _priteBatch);
            Deck1.Initialize();
            Deck2 = new Deck2(this, _priteBatch);
            Deck2.Initialize();
            Deck3 = new Deck3(this, _priteBatch);
            Deck3.Initialize();
            Deck4 = new Deck4(this, _priteBatch);
            Deck4.Initialize();
            // inicialização dos marcadores
            hPPlayer1 = new HPPlayer1(this, _priteBatch, Ninja1);
            hPPlayer1.Initialize();

            hPPlayer2 = new HPPlayer2(this, _priteBatch, Ninja2);
            hPPlayer2.Initialize();
            forcaPlayer1 = new ForcaPlayer1(this, _priteBatch);
            forcaPlayer1.Initialize();
            forcaPlayer2 = new ForcaPlayer2(this, _priteBatch);
            forcaPlayer2.Initialize();

            solo = new SoloBase(this, _priteBatch);
            solo.Initialize();
            ceu = Content.Load <Texture2D>("ceu");
        }
Ejemplo n.º 3
0
        private void initializeDeck()
        {
            List <List <int> > intDeck = FileReader.ReadFile(DeckAddress);

            //Creating Cards and setting them to the decks
            for (int i = 0; i < intDeck.Count; i++)
            {
                Card newCard = new Card(intDeck[i]);

                if (intDeck[i][1] == 1)
                {
                    Deck1.Add(newCard);
                }
                else if (intDeck[i][1] == 2)
                {
                    Deck2.Add(newCard);
                }
                else if (intDeck[i][1] == 3)
                {
                    Deck3.Add(newCard);
                }
            }

            //Shuffling Decks
            ShuffleDecks();

            //Turning 4 cards from each deck
            for (int i = 0; i < 4; i++)
            {
                Display1.Add(Deck1[0]);
                Deck1.RemoveAt(0);
                Display2.Add(Deck2[0]);
                Deck2.RemoveAt(0);
                Display3.Add(Deck3[0]);
                Deck3.RemoveAt(0);
            }
        }
Ejemplo n.º 4
0
 public void replaceDeck3Card(int index)
 {
     Display3[index] = Deck3[0];
     Deck3.RemoveAt(0);
 }