Пример #1
0
    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);
    }
Пример #2
0
    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);
    }
Пример #3
0
    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;
    }
Пример #4
0
 // Start is called before the first frame update
 void Start()
 {
     ObjectActCall     = gameObject.GetComponent <InstallableObjectAct>();
     CompanyValueCall  = GameObject.Find("CompanyManager").GetComponent <CompanyManager>().GetPlayerCompanyValue();
     EmployeeValueCall = CompanyValueCall.GetEmployeeValue().GetComponent <EmployeeValue>();
 }
Пример #5
0
    void SelectCompany()
    {
        List <Worker> TargetWorker = new List <Worker>();

        foreach (var worker in UnHiredList)
        {
            List <GameObject> SelectedCompany = new List <GameObject>();
            foreach (var company in CompanyManagerCall.GetAllCompanyObject())
            {
                CompanyValue TempCompanyValueCall = company.GetComponent <CompanyValue>();
                if (TempCompanyValueCall.TotalValue >= worker.ExpectCompanyValue && TempCompanyValueCall.TotalValue != 0)
                {
                    foreach (var CompanyName in worker.LeaveFactoryList)
                    {
                        if (TempCompanyValueCall.CompanyName == CompanyName)
                        {
                            continue;
                        }
                    }
                    SelectedCompany.Add(company);
                }
            }

            if (SelectedCompany.Count > 0)
            {
                CompanyValue  CompanyValueCall  = SelectedCompany[Random.Range(0, SelectedCompany.Count - 1)].GetComponent <CompanyValue>();
                EmployeeValue EmployeeValueCall = CompanyValueCall.GetEmployeeValue().GetComponent <EmployeeValue>();

                int HiringRate = 2;

                if (EmployeeValueCall.RequiredLabor <= EmployeeValueCall.TotalLabor)
                {
                    HiringRate *= 10 * Mathf.CeilToInt(EmployeeValueCall.TotalLabor - EmployeeValueCall.RequiredLabor + 1);
                }
                if (CompanyValueCall.TotalValue > worker.ExpectCompanyValue)
                {
                    HiringRate *= 1 * Mathf.CeilToInt(CompanyValueCall.TotalValue / worker.ExpectCompanyValue);
                }
                if (CompanyValueCall.TotalValue <= worker.ExpectCompanyValue)
                {
                    HiringRate *= 4 * Mathf.CeilToInt(worker.ExpectCompanyValue / CompanyValueCall.TotalValue);
                }

                if (Random.Range(0, HiringRate) == 0)
                {
                    EmployeeValueCall.HireEmployee(worker);
                    TargetWorker.Add(worker);
                    // Debug.Log(worker.Name + " is Hired on " + CompanyValueCall.CompanyName);
                }
                // else Debug.Log(worker.Name + " doesnt go anywhere");
            }

            if (--worker.TrialCount < 0)
            {
                TargetWorker.Add(worker);
            }
            else
            {
                worker.ExpectCompanyValue -= 0.5f;
            }
        }

        for (int i = 0; i < TargetWorker.Count; i++)
        {
            UnHiredList.Remove(TargetWorker[i]);
        }
    }