Пример #1
0
        public void RewardNinja(IHero hero, IJob chosenJob)
        {
            int heroCashReward = chosenJob.Wage;

            hero.GetCash(heroCashReward);
            this.FightResult = string.Format("Congratulation hero is now working at {0}", chosenJob.ToString());
        }
        public void Sell(ICommercialItem commercialItem, IHero hero)
        {
            // If ninja have enough money to pay, he pays
            if (hero.PayCash(commercialItem.Price))
            {
                // If ninja accepts the item he takes it
                if (hero.GetItem(commercialItem))
                {
                    int index = this.goods.IndexOf(commercialItem);
                    this.goods.RemoveAt(index);

                    var itemRecharge = commercialItem.Clone();
                    this.goods.Insert(index, itemRecharge as ICommercialItem);
                    TurnOver += commercialItem.Price;
                }
                else
                {
                    // Return money
                    hero.GetCash(commercialItem.Price);
                }
            }
        }
Пример #3
0
        public void Sell(ICommercialItem commercialItem, IHero hero)
        {
            // If ninja have enough money to pay, he pays
            if (hero.PayCash(commercialItem.Price))
            {
                // If ninja accepts the item he takes it
                if (hero.GetItem(commercialItem))
                {
                    int index = this.goods.IndexOf(commercialItem);
                    this.goods.RemoveAt(index);

                    var itemRecharge = commercialItem.Clone();
                    this.goods.Insert(index, itemRecharge as ICommercialItem);
                    TurnOver += commercialItem.Price;
                }
                else
                {
                    // Return money
                    hero.GetCash(commercialItem.Price);
                }
            }
        }
 public void RewardNinja(IHero hero, IJob chosenJob)
 {
     int heroCashReward = chosenJob.Wage;
     hero.GetCash(heroCashReward);
     this.FightResult = string.Format("Congratulation hero is now working at {0}", chosenJob.ToString());
 }