Esempio n. 1
0
        public virtual bool processSelectedItem(string selection, Player playerObject)
        {
            string Name = selection.Substring(0, selection.IndexOf("-") - 1);
            int i = 0;

            foreach (recruit currRecruit in recruitTypes)
            {
                if (currRecruit.name == Name)
                {
                    if (playerObject.spendMoney(currRecruit.initialCost))
                    {
                        recruit incrementDealer = (recruit)recruitTypes[i];
                        incrementDealer.currentNumber++;
                        recruitTypes[i] = incrementDealer;
                        updateMenuOptions();
                        return true;
                    }
                }
                i++;
            }

            return false;
        }
        public override bool processSelectedItem(string selection, Player playerObject)
        {
            string Name = selection.Substring(0, selection.IndexOf("-") - 1);

            if (Name == pimp.name)
            {
                if (playerObject.spendMoney(pimp.initialCost))
                {
                    pimp.currentNumber++;
                    updateMenuOptions();
                    return true;
                }
            }
            else if (Name == hitman.name)
            {
                if (playerObject.spendMoney(hitman.initialCost))
                {
                    hitman.currentNumber++;
                    updateMenuOptions();
                    return true;
                }
            }
            else if (Name == bodyguard.name)
            {
                if (playerObject.spendMoney(bodyguard.initialCost))
                {
                    bodyguard.currentNumber++;
                    updateMenuOptions();
                    return true;
                }
            }
            else if (Name == policeBriber.name)
            {
                if (playerObject.spendMoney(policeBriber.initialCost))
                {
                    policeBriber.currentNumber++;
                    updateMenuOptions();
                    return true;
                }
            }
            return false;
        }