Esempio n. 1
0
        internal void markToDestroy()
        {
            toRemove = true;

            //return loans only if banking invented
            if (GetCountry().Invented(Invention.Banking))
            {
                if (loans.isNotZero())
                {
                    Value howMuchToReturn = loans.Copy();
                    if (howMuchToReturn.isSmallerOrEqual(cash))
                    {
                        howMuchToReturn.set(cash);
                    }
                    getBank().takeMoney(this, howMuchToReturn);
                    if (loans.isNotZero())
                    {
                        getBank().defaultLoaner(this);
                    }
                }
            }
            // send remaining money to owners
            foreach (var item in ownership.GetAllShares())
            {
                pay(item.Key as Agent, cash.Copy().multiply(item.Value), false);
                //pay(item.Key as Agent, item.Value.SendProcentOf(cash), false);
            }

            MainCamera.factoryPanel.removeFactory(this);
        }
Esempio n. 2
0
        internal void markToDestroy()
        {
            toRemove = true;

            //return loans only if banking invented
            if (Country.Invented(Invention.Banking))
            {
                if (loans.isNotZero())
                {
                    Value howMuchToReturn = loans.Copy();
                    if (howMuchToReturn.isSmallerOrEqual(Cash))
                    {
                        howMuchToReturn.Set(Cash);
                    }
                    Bank.ReceiveMoney(this, howMuchToReturn);
                    if (loans.isNotZero())
                    {
                        Bank.OnLoanerRefusesToPay(this);
                    }
                }
            }
            // send remaining money to owners
            foreach (var item in ownership.GetAllShares())
            {
                Pay(item.Key as Agent, Cash.Copy().Multiply(item.Value), false);
                //pay(item.Key as Agent, item.Value.SendProcentOf(Cash), false);
            }

            MainCamera.factoryPanel.removeFactory(this);
        }