internal Factory(Province province, Agent factoryOwner, FactoryType type) : base(type, province) { //assuming this is level 0 building constructionNeeds = getType().getBuildNeeds(); province.allFactories.Add(this); setOwner(factoryOwner); salary.set(province.getLocalMinSalary()); if (getCountry().economy.getValue() == Economy.PlannedEconomy) { setPriorityAutoWithPlannedEconomy(); } }
internal void open(IShareOwner byWhom, bool payMoney) { var agent = byWhom as Agent; if (agent.Country.economy.getValue() != Economy.PlannedEconomy) { salary.set(Province.getLocalMinSalary()); } if (payMoney) { agent.PayWithoutRecord(this, getReopenCost()); ownership.Add(byWhom, getReopenCost()); //Debug.Log(byWhom + " invested " + getReopenCost() + " in reopening " + this); } _isOpen = true; daysUnprofitable = 0; daysClosed = 0; }
/// <summary> /// Don't call it directly /// </summary> public Factory(Province province, IShareOwner investor, FactoryType type, Value cost) : base(type, province) { //this.buildByPlannedEconomy = buildByPlannedEconomy; ownership = new Owners(this); if (investor != null) // that mean that factory is a fake { currentInvestor = investor; //assuming this is level 0 building constructionNeeds = new StorageSet(getType().GetBuildNeeds()); ownership.Add(investor, cost); salary.set(province.getLocalMinSalary()); if (GetCountry().economy.getValue() == Economy.PlannedEconomy) { setPriorityAutoWithPlannedEconomy(); } //else // Debug.Log(investor + " invested " + cost + " in building new " + this); } }
/// <summary> /// Enterprise rises salary if labor demand is bigger than labor supply (assuming enterprise is profitable). And vice versa - enterprise lowers salary if labor demand is lower than labor supply. ///More profitable enterprise rises salary faster. /// </summary> public void ChangeSalary() { //Should be rise salary if: small unemployment, has profit, need has other resources if (IsOpen && Economy.isMarket.checkIfTrue(Country)) { var unemployment = Province.GetAllPopulation().Where(x => x.Type == PopType.Workers).GetAverageProcent(x => x.getUnemployment()); var margin = GetMargin(); // rise salary to attract workforce, including workforce from other factories if (margin.isBiggerThan(Options.minMarginToRiseSalary) && unemployment.isSmallerThan(Options.ProvinceLackWorkforce) && //demand >= supply GetVacancies() > 10) // && getInputFactor() == 1) { // cant catch up salaries like that. Check for zero workforce? float salaryRaise = 0.001f; //1% if (margin.get() > 10f) //1000% { salaryRaise = 0.012f; } else if (margin.get() > 1f) //100% { salaryRaise = 0.006f; } else if (margin.get() > 0.3f) //30% { salaryRaise = 0.003f; } else if (margin.get() > 0.1f) //10% { salaryRaise = 0.002f; } salary.add(salaryRaise); } // Reduce salary on non-profit if (margin.isZero() && daysUnprofitable >= Options.minDaysBeforeSalaryCut && !isJustHiredPeople() && !isSubsidized()) { salary.Subtract(0.01f, false); } // if supply > demand if (unemployment.isBiggerThan(Options.ProvinceExcessWorkforce)) { salary.Subtract(0.001f, false); } if (getWorkForce() == 0)// && getInputFactor() == 1) { salary.set(Province.getLocalMinSalary()); } // to help factories catch up other factories salaries // salary.set(province.getLocalMinSalary()); // freshly built factories should rise salary to concurrency with old ones //if (getWorkForce() < 100 && Province.getUnemployedWorkers() == 0 && this.Cash.get() > 10f)// && getInputFactor() == 1) // //salary.set(province.getLocalMinSalary()); // salary.add(0.09f); // limit salary country's min wage var minSalary = Country.getMinSalary(); if (salary.isSmallerThan(minSalary)) { salary.set(minSalary); } } }