Пример #1
0
        protected void onAdversaireMeet(Object sender, AdversaireMeetEventArgs e)
        {
            EventHandler <AdversaireMeetEventArgs> AdvMeet = MeetAdversaire;

            if (AdvMeet != null)
            {
                AdvMeet(this, e);
            }
        }
Пример #2
0
        public void Rencontre(List <Equipe> _EquipeList, List <Personnage> _PersHeroList, List <Personnage> _PersMonstreList)
        {
            do
            {
                List <Personnage> FullList = new List <Personnage>();
                FullList.AddRange(_PersHeroList);
                FullList.AddRange(_PersMonstreList);

                Personnage p1 = getRandomPers(FullList);
                Personnage p2 = getRandomPers(FullList);

                if (_PersMonstreList.Count == 1)
                {
                    p1 = _PersMonstreList[0];
                }

                if (_PersHeroList.Count == 1)
                {
                    p2 = _PersHeroList[0];
                }

                if (p1 is Hero && p2 is Monstre || p1 is Monstre && p2 is Hero)
                {
                    AdversaireMeetEventArgs AdvMeetArgs = new AdversaireMeetEventArgs(p1, p2);
                    onAdversaireMeet(this, AdvMeetArgs);
                }
            } while (_PersHeroList.Count > 0 && _PersMonstreList.Count > 0);

            if (_PersHeroList.Count == 0)
            {
                WinningEventArgrs tWin = new WinningEventArgrs("Monstres");
                onWinning(this, tWin);
            }
            else
            {
                WinningEventArgrs tWin = new WinningEventArgrs("Héros");
                onWinning(this, tWin);
            }
        }
Пример #3
0
        public void Rencontre(List<Equipe> _EquipeList, List<Personnage> _PersHeroList, List<Personnage> _PersMonstreList)
        {
            do
            {
                List<Personnage> FullList = new List<Personnage>();
                FullList.AddRange(_PersHeroList);
                FullList.AddRange(_PersMonstreList);

                Personnage p1 = getRandomPers(FullList);
                Personnage p2 = getRandomPers(FullList);

                if (_PersMonstreList.Count == 1)
                {
                    p1 = _PersMonstreList[0];
                }

                if (_PersHeroList.Count == 1)
                {
                    p2 = _PersHeroList[0];
                }

                if (p1 is Hero && p2 is Monstre || p1 is Monstre && p2 is Hero)
                {
                    AdversaireMeetEventArgs AdvMeetArgs = new AdversaireMeetEventArgs(p1, p2);
                    onAdversaireMeet(this, AdvMeetArgs);
                }
            } while (_PersHeroList.Count > 0 && _PersMonstreList.Count > 0);

            if (_PersHeroList.Count == 0)
            {
                WinningEventArgrs tWin = new WinningEventArgrs("Monstres");
                onWinning(this, tWin);
            }
            else
            {
                WinningEventArgrs tWin = new WinningEventArgrs("Héros");
                onWinning(this, tWin);
            }
        }
Пример #4
0
 protected void onAdversaireMeet(Object sender, AdversaireMeetEventArgs e)
 {
     EventHandler<AdversaireMeetEventArgs> AdvMeet = MeetAdversaire;
     if (AdvMeet != null)
     {
         AdvMeet(this, e);
     }
 }
Пример #5
0
 private static void Program_MeetAdversaire(object sender, AdversaireMeetEventArgs e)
 {
     Console.ForegroundColor = ConsoleColor.DarkYellow;
     Console.WriteLine("RENCONTRE: \n {0} \n {1} ", e.p1.ToString(), e.p2.ToString());
     Console.ResetColor();
     Personnage PersAttaquant = Equipe.chooseRandomAttacker(new List<Personnage> { e.p1, e.p2 });
     if (PersAttaquant.Equals(e.p1))
     {
         PersAttaquant.Attaque(e.p2);
     }
     else
     {
         PersAttaquant.Attaque(e.p1);
     }
 }