protected void SetWorkplaceDetails(Building building) //to be called only for buildings with workplaces. { BuildWorkplaceFieldsReferences(); WorkPlace workPlace = building.gameObject.GetComponent <WorkPlace>(); employeeCount.text = workPlace.CurrentManpower().ToString(); employeeCapacity.text = workPlace.MaxManpower().ToString(); employeeEducationLevel.text = GetEducationLevelString(workPlace.WorkerEducationLevel()); wages.text = workPlace.Wages().ToString(); workplaceQuality.text = workPlace.WorkplaceQuality().ToString(); }
public bool ProcessFinances() //Must be called once per day. Returns false if citizen can pay their expenses. { long income = 0; long expenses = 0; //get paid if (workAddress != null) { income += workAddress.Wages(); } //add rent to expenses expenses += homeAddress.Rent(); //add other life expenses switch (citizenClass) { case CitizenClass.low: expenses += lifeStyleExpensesPerDayLow; break; case CitizenClass.middle: expenses += lifeStyleExpensesPerDayMiddle; break; case CitizenClass.high: expenses += lifeStyleExpensesPerDayHigh; break; } expenses -= income; //if income > expenses, result will be negative, which will increase savings. savings = System.Convert.ToInt64(Mathf.Min(savings - expenses, maxSavings)); if (savings < 0) { //AssignDebt(); return(false); } return(true); }