// Start is called before the first frame update void Start() { CompanyManagerCall = GameObject.Find("CompanyManager").GetComponent <CompanyManager>(); CompanyValueCall = transform.parent.gameObject.GetComponent <CompanyValue>(); EconomyValueCall = CompanyValueCall.GetEconomyValue().GetComponent <EconomyValue>(); TimeManagerCall = GameObject.Find("TimeManager").GetComponent <TimeManager>(); EconomyValueCall.AddPersistHistory(TimeManagerCall.GetNextMonth(0), TimeManagerCall.Month, "Real Estate", "Land Tax", "Land Tax", 0); // EconomyValueCall.AddHistory(TimeManagerCall.TimeValue, "Real Estate", "Land Tax", "Land Tax", 0, true); }
// Start is called before the first frame update void Start() { ValueCall = GameObject.Find("BaseSystem").GetComponent <InGameValue>(); TimeManagerCall = GameObject.Find("TimeManager").GetComponent <TimeManager>(); CompanyManagerCall = transform.parent.parent.gameObject.GetComponent <CompanyManager>(); CompanyValueCall = transform.parent.gameObject.GetComponent <CompanyValue>(); EconomyValueCall = CompanyValueCall.GetEconomyValue().GetComponent <EconomyValue>(); PanelControllerCall = GameObject.Find("Canvas").GetComponent <PanelController>(); ActivatedLabor = 0; ActivatedRequiredLabor = 0; RotateTimeLimit = 200; RotateTimer = RotateTimeLimit; if (CompanyValueCall.CompanyName == CompanyManagerCall.PlayerCompanyName) { PanelControllerCall.UpdateFactoryInfo("Employee", TotalLabor, RequiredLabor); } }
// Start is called before the first frame update void Start() { isInstall = false; BaseSystem = GameObject.Find("BaseSystem"); ValueCall = BaseSystem.GetComponent <InGameValue>(); PanelControllerCall = GameObject.Find("Canvas").GetComponent <PanelController>(); ClickCheckerCall = BaseSystem.GetComponent <ClickChecker>(); GroupActivationCall = BaseSystem.GetComponent <GroupActivation>(); TimeManagerCall = GameObject.Find("TimeManager").GetComponent <TimeManager>(); EconomyValueCall = GameObject.Find("CompanyManager").GetComponent <CompanyManager>().GetPlayerCompanyValue().GetEconomyValue().GetComponent <EconomyValue>(); NotificationManagerCall = GameObject.Find("NotificationManager").GetComponent <NotificationManager>(); CompanyValueCall = GameObject.Find("CompanyManager").GetComponent <CompanyManager>().GetPlayerCompanyValue(); WorkSpeed = 1f; IsWorking = false; GetWholeStructObject(); GetOriginalStructColor(); CheckInstallCondition(); }
void InitializePlayerCompany() { GameObject newCompany = GameObject.Instantiate(Resources.Load <GameObject>("GameSystem/Company/Object/Player")); newCompany.transform.SetParent(CompanyManagerObject.transform); CompanyManager CompanyManagerCall = CompanyManagerObject.GetComponent <CompanyManager>(); WorkerSelector WorkerSelectorCall = GameObject.Find("WorkerManager").GetComponent <WorkerSelector>(); CompanyManagerCall.AddCompany(CompanyName, newCompany); CompanyManagerCall.PlayerCompanyName = CompanyName; newCompany.name = CompanyName; EconomyValue EconomyValueCall = CompanyManagerCall.GetPlayerCompanyValue().GetEconomyValue().GetComponent <EconomyValue>(); EconomyValueCall.Balance = 40000; WorkerSelector.Worker CEO = WorkerSelectorCall.AddCustomWorker(null, 3, 0, 0, 0, 0, 0); CompanyManagerCall.GetPlayerCompanyValue().GetEmployeeValue().GetComponent <EmployeeValue>().HireEmployee(CEO); WorkerSelectorCall.UnHiredList.Remove(CEO); }
void Awake() { CallCompanyValue = GameObject.Find("CompanyManager").GetComponent <CompanyManager>().GetPlayerCompanyValue(); CallEconomyValue = CallCompanyValue.GetEconomyValue().GetComponent <EconomyValue>(); CallBankValue = GameObject.Find("BaseSystem").GetComponent <BankValue>(); CallTimeManager = GameObject.Find("TimeManager").GetComponent <TimeManager>(); CallNotificationManager = GameObject.Find("NotificationManager").GetComponent <NotificationManager>(); IncomePieGraphPanel = SummaryPanel.transform.GetChild(0).gameObject; IncomePieGraphCarrier = IncomePieGraphPanel.transform.GetChild(1).gameObject; ExpensePieGraphPanel = SummaryPanel.transform.GetChild(1).gameObject; ExpensePieGraphCarrier = ExpensePieGraphPanel.transform.GetChild(1).gameObject; SummaryReportPanel = SummaryPanel.transform.GetChild(2).gameObject; SummaryReportCarrier = SummaryReportPanel.transform.GetChild(0).gameObject; DetailReportCategoryPanel = DetailReportPanel.transform.GetChild(0).gameObject; DetailReportInnerPanel = DetailReportPanel.transform.GetChild(1).gameObject; DetailReportPanelCategoryDropdown = DetailReportCategoryPanel.transform.GetChild(1).gameObject; DetailReportCarrier = DetailReportInnerPanel.transform.GetChild(0).gameObject; BankListPanel = LoanPanel.transform.GetChild(1).GetChild(0).GetChild(0).GetChild(0).gameObject; LoanFunctionPanel = LoanPanel.transform.GetChild(1).GetChild(1).GetChild(0).gameObject; }
public List <float> BuyItem(string Name, string BuyerName, int Num) { List <float> result = new List <float>(); int Index = getSalesIndex(Name); if (Index == -1) { Debug.Log("No Info of " + Name + ". Try from " + BuyerName); result.Add(-1f); return(result); } SalesInfo TargetItem = SalesItemArray[Index]; GoodsValue SellerGoodsValueCall = CompanyManagerCall.GetCompanyValue(TargetItem.Seller).GetGoodsValue().GetComponent <GoodsValue>(); EconomyValue SellerEconomyCall = CompanyManagerCall.GetCompanyValue(TargetItem.Seller).GetEconomyValue().GetComponent <EconomyValue>(); int Limit = 0; if (TargetItem.ItemCount >= Num) { Limit = Num; } else if (TargetItem.ItemCount > 0) { Limit = TargetItem.ItemCount; } else { // Debug.Log("Lack of stock " + TargetItem.ItemCount + " " + Num); result.Add(-2f); return(result); } float TotalQualityValue = TargetItem.QualityEvaluation * TargetItem.SoldCount; for (int i = 0; i < Limit; i++) { int GoodsID = SellerGoodsValueCall.FindGoodsID(Name, false); if (GoodsID == -1) { Debug.Log("No Info of " + TargetItem.Seller + "'s " + Name + ". Try from " + BuyerName); result.Add(-1f); return(result); } if (BuyerName != "Consumer") { GoodsValue BuyerGoodsValueCall = CompanyManagerCall.GetCompanyValue(BuyerName).GetGoodsValue().GetComponent <GoodsValue>(); EconomyValue BuyerEconomyCall = CompanyManagerCall.GetCompanyValue(BuyerName).GetEconomyValue().GetComponent <EconomyValue>(); if (BuyerEconomyCall.Balance < TargetItem.Price) { result.Add(0f); return(result); } BuyerGoodsValueCall.AddGoodsArray(Name, SellerGoodsValueCall.CheckQuality(GoodsID)); BuyerEconomyCall.AddHistory(TimeManagerCall.TimeValue, "Buy", Name, "Buy " + Name + " from " + TargetItem.Seller, -TargetItem.Price); } result.Add(SellerGoodsValueCall.CheckQuality(GoodsID)); SellerGoodsValueCall.DeleteGoodsArray(GoodsID); SellerEconomyCall.AddHistory(TimeManagerCall.TimeValue, "Sell", Name, TargetItem.Seller + " Sells " + Name + " to " + BuyerName, TargetItem.Price); if (TargetItem.Seller == CompanyManagerCall.PlayerCompanyName && TargetItem.SoldCount == 0) { NotificationManagerCall.AddNews("Award", "Your first shipment of " + Name + " products has been made!"); } TargetItem.ItemCount--; TargetItem.SoldCount++; } foreach (var quality in result) { TotalQualityValue += quality; } TargetItem.QualityEvaluation = TotalQualityValue / TargetItem.SoldCount; if (PanelControllerCall.CurrentSidePanel != null) { if (PanelControllerCall.CurrentSidePanel.name == "ContractPanel") { ContractPanelController PanelComponent = PanelControllerCall.CurrentSidePanel.GetComponent <ContractPanelController>(); PanelComponent.UpdateRemainQuantityText(); if (PanelComponent.CurrentItem == TargetItem.RecipeInfo.Recipe.OutputName) { PanelComponent.UpdateSalesInfo(); } } } return(result); }