Exemple #1
0
        public void FightHappend(BaseGatherer enemy)
        {
            var engine = new GameEngine(GathererSettings.Instance.GetHeroType(), enemy, _fightNotifiations);

            engine.Fight();

            Thread.Sleep(100);
            _fightNotifiations.WinnerReport(new FightReportArgs()
            {
                Winner = engine.Winner
            });
            Thread.Sleep(1000);
        }
        public void Fight()
        {
            BaseGatherer attacker, defender;

            attacker = Hero;
            defender = Enemy;

            while (attacker.IsAlive)
            {
                double attack = attacker.Attack();
                double damage = defender.Defend(attack);

                notifictions.FightReport(new FightReportArgs()
                {
                    GathererHero   = attacker,
                    GathererEnemy  = defender,
                    Attack         = attack,
                    DamageRecieved = damage
                });

                Thread.Sleep(100);

                BaseGatherer temp;
                temp     = attacker;
                attacker = defender;
                defender = temp;
            }

            if (Hero.IsAlive)
            {
                Winner = Hero;
            }
            else
            {
                Winner = Enemy;
            }
        }
Exemple #3
0
 public void SetPlayerClass(BaseGatherer gathererClass)
 {
     GathererClass = gathererClass;
 }
 public GameEngine(BaseGatherer hero, BaseGatherer enemy, IFightNotifiations notifictions)
 {
     Hero              = hero;
     Enemy             = enemy;
     this.notifictions = notifictions;
 }