예제 #1
0
        /// <summary>
        /// Don't use it for aristocrats
        /// Doesn't check if enterprise is invented, also doesn't check
        /// conNotLForNotCountry, conAllowsForeignInvestments, conHaveMoneyOrResourcesToUpgrade
        /// </summary>
        public IEnumerable <IInvestable> AllInvestmentProjects()//Agent investor
        {
            var upgradeInvestments = AllFactories.Where(x =>
                                                        Factory.conditionsUpgrade.isAllTrue(null, x) //investor
                                                                                                     //x.Province.CanUpgradeFactory(x.Type, investor)
                                                        && x.GetWorkForceFulFilling().isBiggerThan(Options.minFactoryWorkforceFulfillingToInvest)
                                                        );

            foreach (var item in upgradeInvestments)
            {
                yield return(item);
            }

            var buildInvestments = ProductionType.getAllInventedByAnyoneFactories().Where(x => x.canBuildNewFactory(this, null)); //investor

            foreach (var item in buildInvestments)
            {
                yield return(new NewFactoryProject(this, item));
            }

            // Don't need extra check (notLf, allowsForeignInvestments) in 2 next circle.
            //Because AI Countries use it only for themselves, Aristocrats use it only in won province
            foreach (var item in GetSales())
            {
                yield return(item);
            }

            var reopenEnterprises = AllFactories.Where(x => x.IsClosed && !x.isBuilding());

            foreach (var item in reopenEnterprises)
            {
                yield return(item);
            }
        }
예제 #2
0
 protected void FireAllWorkers()
 {
     foreach (var worker in AllWorkers)
     {
         //var worker = item as Workers;
         //if (worker != null)
         worker.Fire();
     }
     AllFactories.PerformAction(x => x.ClearWorkforce());
 }