コード例 #1
0
ファイル: NPC.cs プロジェクト: paulfysh/CriminalEmpires
        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;
        }
コード例 #2
0
        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;
        }