public void Sell(ICommercial commercialItem, Ninja ninja)
        {
            // If ninja have enough money to pay, he pays
            if (ninja.PayForItem(commercialItem))
            {
                // If ninja accepts the item he takes it
                if (ninja.GetItem(commercialItem as Item))
                {
                    int index = this.goods.IndexOf(commercialItem);
                    this.goods.RemoveAt(index);

                    var itemRecharge = commercialItem.Clone();
                    this.goods.Insert(index, itemRecharge as ICommercial);
                }
                else
                {
                    // Return money
                    ninja.GetCash(commercialItem.Price);
                }
            }
        }
Beispiel #2
0
        private void RewardNinja(Ninja ninja, Job chosenJob)
        {
            int ninjaCashReward = chosenJob.Wage;

            ninja.GetCash(ninjaCashReward);
        }