Ejemplo n.º 1
0
        public PlayerBox(Player player)
        {
            Player = player;

            lbCards = new ListBox();
            lbCards.Name = "cardList";
            lbCards.Top = 10;
            lbCards.Left = 5;
            lbCards.Width = 100;
            lbCards.Height = 120;
            cardsSource = new BindingSource(player.Cards, null);
            lbCards.DataSource = cardsSource;

            lblBlood = new Label();
            lblBlood.Text = player.Blood.ToString();
            lblBlood.Top = 130;

            lblGear = new Label();
            lblGear.Text = player.Gear?.ToString();
            lblGear.Top = 150;

            lblArmor = new Label();
            lblArmor.Text = player.Armor?.ToString();
            lblArmor.Top = 170;

            this.Text = player.name;
            this.Name = "groupbox";
            this.Height = 200;
            this.Width = 120;

            this.Controls.Add(lbCards);
            this.Controls.Add(lblBlood);
            this.Controls.Add(lblGear);
            this.Controls.Add(lblArmor);
        }
Ejemplo n.º 2
0
        protected void GameLoop()
        {
            int indexOfCurrentPlayer = 0;
            activePlayer = players[indexOfCurrentPlayer];

            while (!GameOver())
            {
                Console.WriteLine("Here is the board:");
                PrintBoard();

                TakeTurn(activePlayer);
                //select the other player
                indexOfCurrentPlayer = (indexOfCurrentPlayer == 0) ? 1 : 0;
                activePlayer = players[indexOfCurrentPlayer];

                //Added this slight delay for user experience.  Without it it's harder to notice the board repaint
                //try commenting it out and check out the difference.  Which do you prefer?
                System.Threading.Thread.Sleep(300);

                Console.Clear();
            }
        }
Ejemplo n.º 3
0
 public void Respond()
 {
     offenderCard = _gctx.cardDress.VirtualCard;
     foreach (var t in _gctx.targets)
     {
         currentTarget = t;
         RespondOne();
     }
 }
Ejemplo n.º 4
0
        public void PlainResult()
        {
            if (_gctx.targets.Any())
            {
                currentTarget = _gctx.targets.First();

                OnTolerateResult(this, new EventArgs());
                if (offenderCard is Glucose)
                {
                    currentTarget.AddBlood();
                }
            }
        }
Ejemplo n.º 5
0
 public void TurnToNextPlayer()
 {
     int index = players.IndexOf(currentPlayer);
     if (players.IndexOf(currentPlayer) < players.Count - 1)
     {
         currentPlayer = players[++index];
     }
     else
     {
         round++;
         currentPlayer = players.First();
     }
 }
Ejemplo n.º 6
0
 public void TurnToFirstPlayer()
 {
     currentPlayer = players.First();
 }
Ejemplo n.º 7
0
 protected void TakeTurn(Player activePlayer)
 {
     int[] position = PiecePlacement(activePlayer);
     board.setSquare(position[0], position[1], activePlayer.Token);
 }
Ejemplo n.º 8
0
        private int[] PiecePlacement(Player activePlayer)
        {
            //you need to be using the .NET framework 4.6 for this line to work (C# 6)
            Console.WriteLine();
            Console.WriteLine($"{activePlayer.Name}, it's your turn:");
            Console.WriteLine("Make your move by entering the number of the sqaure you'd like to take:");
            PrintBoardMap();
            Console.Write("Enter the number: ");

            //todo: Prevent returning a location that's already been used

            return ConvertToArrayLocation(Console.ReadLine());
        }