Esempio n. 1
0
        private void OnTimedEvent(object source, ElapsedEventArgs e)
        {
            if (FirstWrestler.lifePoint > 0 & SecondWrestler.lifePoint > 0 && Iteration < IterationMax)
            {
                if (!midRound)
                {
                    Rounds.Add(new Round(Iteration + 1));
                    CurrentRound = Rounds.Last();
                    Console.WriteLine($"\nRound #{CurrentRound.id}");
                    Profit += 5000;

                    Console.WriteLine($"{WrestlerRound.Name} choisit sa stratégie!");
                    CurrentRound.Beginner    = WrestlerRound;
                    CurrentRound.FirstAction = WrestlerRound.ChooseAction(SecondWrestler);

                    if (WrestlerRound == FirstWrestler)
                    {
                        WrestlerRound = SecondWrestler;
                    }
                    else
                    {
                        WrestlerRound = FirstWrestler;
                    }

                    midRound = true;
                }
                else
                {
                    Console.WriteLine($"{WrestlerRound.Name} choisit sa stratégie!");
                    CurrentRound.Second       = WrestlerRound;
                    CurrentRound.SecondAction = WrestlerRound.ChooseAction(FirstWrestler);
                    if (WrestlerRound == FirstWrestler)
                    {
                        WrestlerRound = SecondWrestler;
                    }
                    else
                    {
                        WrestlerRound = FirstWrestler;
                    }
                    midRound = false;

                    CurrentRound.PlayRound();
                    Iteration++;
                }
            }
            else
            {
                EndOfMatch();
                Console.WriteLine($"Bravo ! Vous avez gagné {Profit} euros");
                timer.Enabled = false;
                timer.Close();
                isEnd   = true;
                isReady = false;
            }
        }