void FixedUpdate()
    {
        //Check if there is and local jobs available and if there is any workers available
        if (local_employed < max_employed && data_manager_script.Check_Employer_Slots(0) > 0)
        {
            //Subtracts that worker from the employer slots
            data_manager_script.Change_Employer_Slots(0, -1);
            //Add a worker to the local_employed
            local_employed += 1;
        }

        //Checks if there is a local worker and that the employer slots are negative
        if (local_employed > 0 && data_manager_script.Check_Employer_Slots(0) < 0)
        {
            //Adds a worker to the employer slots
            data_manager_script.Change_Employer_Slots(0, 1);
            //Subtracts a worker to the local_employed
            local_employed -= 1;
        }

        //Checks if the time sice this scritpt stated is greater that current_time
        if (Time.time > next_time)
        {
            //Checks to see if it will go over the maximum storage.
            if (data_manager_script.Check_Resources(1) + 6 * local_employed / max_employed <= data_manager_script.Get_Max_Storage())
            {
                //Add resources to inventory
                data_manager_script.Change_Resources(1, 6 * local_employed / max_employed);
            }
            //Add the current time to varible add_time
            next_time = Time.time + add_time;
        }
    }
Ejemplo n.º 2
0
    void FixedUpdate()
    {
        //Check if there is and local jobs available and if there is any workers available
        if (local_employed < max_employed && data_manager_script.Check_Employer_Slots(2) > 0)
        {
            //Subtracts that worker from the employer slots
            data_manager_script.Change_Employer_Slots(2, -1);
            //Add a worker to the local_employed
            local_employed += 1;
        }

        //Checks if there is a local worker and that the employer slots are negative
        if (local_employed > 0 && data_manager_script.Check_Employer_Slots(2) < 0)
        {
            //Adds a worker to the employer slots
            data_manager_script.Change_Employer_Slots(2, 1);
            //Subtracts a worker to the local_employed
            local_employed -= 1;
        }

        //Checks if the time sice this scritpt stated is greater that current_time
        if (Time.time > next_time)
        {
            //Checks to see it adding this resource will put it over the max_storage
            if (data_manager_script.Check_Resources(3) + Mathf.Ceil(area * local_employed / max_employed) * 1000 <= data_manager_script.Get_Max_Storage())
            {
                //Add resources to inventory
                data_manager_script.Change_Resources(3, Mathf.Ceil(area * local_employed / max_employed) * 1000);
            }
            //Add the current time to varible add_time
            next_time = Time.time + add_time;
        }
    }
 void Unemployment_Controller()
 {
     //Check to see if anyone is employed in each job
     //If so then it removes a job and an employment slot
     if (data_manager_script.Check_Total_Employed(0) > 0)
     {
         data_manager_script.Change_Total_Employed(0, -1);
         data_manager_script.Change_Employer_Slots(0, -1);
     }
     else if (data_manager_script.Check_Total_Employed(1) > 0)
     {
         data_manager_script.Change_Total_Employed(1, -1);
         data_manager_script.Change_Employer_Slots(1, -1);
     }
     else if (data_manager_script.Check_Total_Employed(2) > 0)
     {
         data_manager_script.Change_Total_Employed(2, -1);
         data_manager_script.Change_Employer_Slots(2, -1);
     }
     else if (data_manager_script.Check_Total_Employed(3) > 0)
     {
         data_manager_script.Change_Total_Employed(3, -1);
         data_manager_script.Change_Employer_Slots(3, -1);
     }
     else if (data_manager_script.Check_Total_Employed(4) > 0)
     {
         data_manager_script.Change_Total_Employed(4, -1);
         data_manager_script.Change_Employer_Slots(4, -1);
     }
     //Continues to run the method while unemployed is less than zero
     if (data_manager_script.Get_Unemployed() < 0)
     {
         Unemployment_Controller();
     }
 }
Ejemplo n.º 4
0
 //INCREASING AND DECREASNG BUTTONS
 void UI_Increase_Buttons(int job_key)
 {
     //Alls method to be run only once when the button is pressed
     if (button_pressed == false)
     {
         //If the number of employed in this job is less that the number of this type of jobs
         if (data_manager_script.Check_Total_Employed(job_key) < data_manager_script.Check_Jobs(job_key) && data_manager_script.Get_Unemployed() > 0)
         {
             //Adds 1 from the employment slots
             data_manager_script.Change_Employer_Slots(job_key, 1);
             //Add 1 to the total employed in a specific job
             data_manager_script.Change_Total_Employed(job_key, 1);
         }
         //Changes bool to true
         button_pressed = true;
     }
 }