public FacilityInfo AddFacilityInfo(GameObject Object) { FacilityInfo newFacility = new FacilityInfo(); newFacility.Object = Object; newFacility.ObjectActCall = Object.GetComponent <InstallableObjectAct>(); newFacility.isActive = true; newFacility.SuppliedElectricity = 0f; newFacility.SuppliedLabor = 0; newFacility.InstallDate = TimeManagerCall.TimeValue; FacilityList.Add(newFacility); InstalledFacilityAmount++; CompanyValueCall.GetEconomyValue().GetComponent <EconomyValue>().AddHistory(TimeManagerCall.TimeValue, "Install", newFacility.ObjectActCall.Info.Name, "Install " + Object.name, -newFacility.ObjectActCall.Info.Price); CompanyValueCall.GetEconomyValue().GetComponent <EconomyValue>().AddPersistHistory(TimeManagerCall.GetNextMonth(0, newFacility.ObjectActCall.Info.UpkeepMonthTerm) + (TimeManagerCall.TimeValue % TimeManagerCall.Month), newFacility.ObjectActCall.Info.UpkeepMonthTerm * TimeManagerCall.Month, "Upkeep", newFacility.ObjectActCall.Info.Name, Object.name + "'s Upkeep Price", -newFacility.ObjectActCall.Info.UpkeepPrice); CompanyValueCall.GetElectricityValue().GetComponent <ElectricityValue>().AddObject(newFacility); CompanyValueCall.GetEmployeeValue().GetComponent <EmployeeValue>().AddLaborInfo(newFacility); return(newFacility); }
// Start is called before the first frame update void Start() { ObjectActCall = gameObject.GetComponent <InstallableObjectAct>(); CompanyValueCall = GameObject.Find("CompanyManager").GetComponent <CompanyManager>().GetPlayerCompanyValue(); ElectricityValueCall = CompanyValueCall.GetElectricityValue().GetComponent <ElectricityValue>(); CurrentChargingAmount = 0; }
// Update is called once per frame void FixedUpdate() { if (ObjectActCall.isInstall && !isInitialized) { isInitialized = true; ObjectActCall.IsWorking = true; CompanyValueCall.GetElectricityValue().GetComponent <ElectricityValue>().AddElectricityInput(gameObject); } }
public bool CompleteResearch(ResearchState TargetResearch) { TargetResearch.TargetState.Completed = true; CheckTechPossible(); foreach (var FacilityName in TargetResearch.TargetState.Info.UnlockFacility) { if (FacilityName == "None") { break; } TechRecipe.FacilityInfo TargetFacility = TechRecipeCall.GetFacilityInfo(FacilityName); FacilityList.Add(TargetFacility); } foreach (var ActorName in TargetResearch.TargetState.Info.UnlockActor) { if (ActorName == "None") { break; } TechRecipe.ProcessActorInfo TargetActor = TechRecipeCall.GetProcessActorInfo(ActorName); ActorList.Add(TargetActor); } switch (TargetResearch.TargetState.Info.UpgradeValueType) { case "Work": CompanyValueCall.GetEmployeeValue().GetComponent <EmployeeValue>().WorkEifficiency = TargetResearch.TargetState.Info.UpgradeValueAmount; break; case "Energy": CompanyValueCall.GetElectricityValue().GetComponent <ElectricityValue>().EnergyEfficiency = TargetResearch.TargetState.Info.UpgradeValueAmount; break; case "Organize": CompanyValueCall.GetGoodsValue().GetComponent <GoodsValue>().OrganizeEfficiency = TargetResearch.TargetState.Info.UpgradeValueAmount; break; } ResearchPanelUpdate(TargetResearch); int limit = TargetResearch.LabatoryList.Count; for (int i = 0; i < limit; i++) { LabatoryAct TargetLabatoryAct = TargetResearch.LabatoryList[0].GetComponent <LabatoryAct>(); TargetLabatoryAct.StopResearch(); } ResearchStateList.Remove(TargetResearch); TargetResearch = null; return(true); }
void Awake() { CallTimeManager = GameObject.Find("TimeManager").GetComponent <TimeManager>(); CallCompanyManager = GameObject.Find("CompanyManager").GetComponent <CompanyManager>(); CallCompanyValue = CallCompanyManager.GetPlayerCompanyValue(); CallElectricityValue = CallCompanyValue.GetElectricityValue().GetComponent <ElectricityValue>(); CallEmployeeValue = CallCompanyValue.GetEmployeeValue().GetComponent <EmployeeValue>(); CallGoodsValue = CallCompanyValue.GetGoodsValue().GetComponent <GoodsValue>(); CallFacilityValue = CallCompanyValue.GetFacilityValue().GetComponent <FacilityValue>(); ElectricityGraphPanelCarrier = GraphCarrier.transform.GetChild(0).gameObject; LaborForceGraphPanelCarrier = GraphCarrier.transform.GetChild(2).gameObject; ProcessGraphPanelCarrier = GraphCarrier.transform.GetChild(4).gameObject; ProcessGraphIndexPanel = ProcessGraphIndexCarrier.transform.parent.gameObject; }