Exemplo n.º 1
0
    public void PromoteEmployee(int Index)
    {
        int UpgradeValue = Random.Range(2, Random.Range(6, Random.Range(8, 11)));

        EmployeeList[Index].BaseInfo.LaborForce += UpgradeValue;
        TotalLabor += UpgradeValue;

        int PayRaiseValue = Mathf.CeilToInt((float)EmployeeList[Index].BaseInfo.LaborForce / 2f * (float)UpgradeValue * Random.Range(1.5f, Random.Range(2f, Random.Range(3.5f, 5f))));

        EmployeeList[Index].BaseInfo.Salary += PayRaiseValue;
        EconomyValueCall.ModifyPersistHistory("Employee #" + EmployeeList[Index].Index + " Pay", EmployeeList[Index].BaseInfo.Salary);

        EmployeeList[Index].Experience = 0;

        if (CompanyValueCall.CompanyName == CompanyManagerCall.PlayerCompanyName)
        {
            PanelControllerCall.UpdateFactoryInfo("Employee", TotalLabor, RequiredLabor);
            if (PanelControllerCall.CurrentSidePanel != null)
            {
                if (PanelControllerCall.CurrentSidePanel.name == "WorkerPanel")
                {
                    WorkerPanelController PanelComponent = PanelControllerCall.CurrentSidePanel.GetComponent <WorkerPanelController>();

                    PanelComponent.DisplayWorkerList();
                }
            }
        }
    }
Exemplo n.º 2
0
    void DeleteEmployee(EmployeeInfo Employee)
    {
        TotalLabor -= Employee.BaseInfo.LaborForce;

        int TargetIndex = GetEmployeeIndex(Employee);

        EconomyValueCall.DeletePersistHistory("Employee #" + Employee.Index + " Pay");
        EmployeeList.RemoveAt(TargetIndex);
        Employee.BaseInfo.LeaveFactoryList.Add(CompanyValueCall.CompanyName);
        GameObject.Find("WorkerManager").GetComponent <WorkerSelector>().UnHiredList.Add(Employee.BaseInfo);

        if (CompanyValueCall.CompanyName == CompanyManagerCall.PlayerCompanyName)
        {
            PanelControllerCall.UpdateFactoryInfo("Employee", TotalLabor, RequiredLabor);
            if (PanelControllerCall.CurrentSidePanel != null)
            {
                if (PanelControllerCall.CurrentSidePanel.name == "WorkerPanel")
                {
                    WorkerPanelController PanelComponent = PanelControllerCall.CurrentSidePanel.GetComponent <WorkerPanelController>();

                    PanelComponent.DisplayWorkerList();
                    if (PanelComponent.CurrentWorkerIndex == TargetIndex)
                    {
                        PanelComponent.ClearInfoPanel();
                    }
                }
            }
        }
    }
Exemplo n.º 3
0
    public void HireEmployee(WorkerSelector.Worker newWorker)
    {
        EmployeeInfo newEmployee = new EmployeeInfo();

        newEmployee.Index                = CurrentIndex++;
        newEmployee.BaseInfo             = newWorker;
        newEmployee.FatigueValue         = newWorker.LaborForce * 0.5f;
        newEmployee.CurrentLaborForce    = newWorker.LaborForce;
        newEmployee.CurrentSincerityRate = newWorker.SincerityRate;
        newEmployee.Happiness            = 0.45f;
        newEmployee.isResting            = false;
        newEmployee.isWorking            = false;
        newEmployee.CurrentDayRoom       = null;

        EmployeeList.Add(newEmployee);
        TotalLabor += newWorker.LaborForce;

        if (EmployeeList.Count != 1)
        {
            EconomyValueCall.AddPersistHistory(TimeManagerCall.GetNextMonth(0), TimeManagerCall.Month, "Employee Pay", "#" + newEmployee.Index + " " + newEmployee.BaseInfo.Name, "Employee #" + newEmployee.Index + " Pay", -newEmployee.BaseInfo.Salary);
            CompanyValueCall.GetLandValue().GetComponent <LandValue>().ChangeLandValue(200);

            if (CompanyValueCall.CompanyName == CompanyManagerCall.PlayerCompanyName)
            {
                GameObject.Find("NotificationManager").GetComponent <NotificationManager>().AddNews("Info", newWorker.Name + " is new partner.");
                // Debug.Log(newEmployee.BaseInfo.Name + " " + newEmployee.BaseInfo.LaborForce + " " + newEmployee.BaseInfo.Salary);

                PanelControllerCall.UpdateFactoryInfo("Employee", TotalLabor, RequiredLabor);
                if (PanelControllerCall.CurrentSidePanel != null)
                {
                    if (PanelControllerCall.CurrentSidePanel.name == "WorkerPanel")
                    {
                        WorkerPanelController PanelComponent = PanelControllerCall.CurrentSidePanel.GetComponent <WorkerPanelController>();

                        PanelComponent.DisplayWorkerList();
                    }
                }
            }
        }
    }