private void maintainBusiness() { for (short x = 0; x < 4; x++) { //int tempFocus; int tempNumber; float tempProgress; workStation useThis = business.workStations[x]; switch (business.workStations[x].type) { case 4: //calculate progress since last update and add to the exsisting progress tempProgress = (business.customerIncrease * Time.deltaTime) / useThis.timeMain; tempProgress = useThis.orders[0].progress + tempProgress; //the store is fully dirty or unmaintained if (useThis.orders[0].progress == 1 && useThis.orders[0].wants[0] == 100) { return; } if (tempProgress >= 1) { // makes a new number to be the amount of times the bar was filled tempNumber = (int)Mathf.Floor(tempProgress); //make new variable to hold the progress less than 1 tempProgress = tempProgress - tempNumber; //if the amount if full stop at full if (useThis.orders[0].wants[0] == 100) { tempProgress = 1; } else { //add the amount and update happiness useThis.orders[0].wants[0] = useThis.orders[0].wants[0] + tempNumber; business.negativeHappiness[x] = useThis.orders[0].wants[0]; if (business.negativeHappiness[x] > 50) { business.negativeHappiness[x] = 50; } updateHappiness(); } upDateAmount(x, null); } foreach (employee tempEmployee in business.employeesInfo) { if (tempEmployee.workingIn == x) { tempEmployee.task.progress = tempProgress; upDateAmount(x, tempEmployee); } } useThis.orders[0].progress = tempProgress; break; } } }
//adds customers once a day(every 24 sec) private void addCustomers(workStation useThis) { //if happiness is greater than 90% increase the amount of customers that come per day/ if happiness is lower that 90 decrease if (business.happiness > 90) { int temp = (int)(business.happiness) - 90; business.customerIncrease = business.customerIncrease * (1 + (((float)temp / 100) * player.level)); } else if (business.happiness < 90) { int temp = Mathf.Abs((int)(business.happiness) - 90); business.customerIncrease = business.customerIncrease * (1 - (((float)temp / 100) * player.level)); if (business.customerIncrease < 2) { business.customerIncrease = 2; } } //update the hapiness based on customers waiting int percent = (int)Mathf.Floor(useThis.orders.Count / 20); if (percent == 0) { business.negativeHappiness[needsCustomers] = business.negativeHappiness[needsCustomers] - 1; if (business.negativeHappiness[needsCustomers] < 0) { business.negativeHappiness[needsCustomers] = 0; } } else { business.negativeHappiness[needsCustomers] = business.negativeHappiness[needsCustomers] + percent; if (business.negativeHappiness[needsCustomers] > 50) { business.negativeHappiness[needsCustomers] = 50; } } updateHappiness(); int tempCustomers = (int)Mathf.Round(business.customerIncrease); //update the customers waiting for (int x = 0; x < tempCustomers; x++) { int[] want = new int[] { 0 }; order order = new order(mainControl.getName(), want, false); useThis.orders.Add(order); } upDateAmount(needsCustomers); }
public void setUpStoreInfo(int station) { workStation useThis = business.workStations[station]; //calculate the filth created since created since last tick storeInfo[0] = business.customerIncrease / useThis.timeMain; foreach (employee employee in business.employeesInfo) { if (employee.workingIn == station) { //creates the amount of progress in the last update taking into account the focus multiplyer float progress = ((employee.focus * employee.focusMultiplyer[station]) / (useThis.timeMain / employee.timeMultiplyer[station])) * player.decreaseAmount * (player.skillPercent[0] / 100F); progress = progress * getWorkForHappiness(employee); if (player.playerEmployee.workingIn == station) { progress = progress * ((100 + player.percentEffect) / 100F); } storeInfo[1] = storeInfo[1] + progress; } } storeInfo[2] = storeInfo[1] - storeInfo[0]; storeInfo[3] = useThis.orders[0].wants[0] + useThis.orders[0].progress; }
//this is the template that runs each workstation depending on there type private void updateStations(int place, workStation useThis) { int tempFocus; int tempNumber; float tempProgress; switch (useThis.type) { case 0: //set the amount of focus that the player has in this work station tempFocus = player.focus[place]; //creates the amount of progress in the last update taking into account the focus multiplyer tempProgress = (tempFocus * player.playerEmployee.focusMultiplyer[place] * Time.deltaTime) / (useThis.timeMain / player.playerEmployee.timeMultiplyer[place]); //adds the progresses together to get the current progress tempProgress = tempProgress + useThis.orders[0].progress; if (tempProgress >= 1) { // makes a new number to be the amount of times the bar was filled tempNumber = (int)Mathf.Floor(tempProgress); //make new variable to hold the progress less than 1 tempProgress = tempProgress - tempNumber; useThis.orders[0].wants[1] = useThis.orders[0].wants[1] + tempNumber; upDateAmount(place); } useThis.slider.value = tempProgress; useThis.orders[0].progress = tempProgress; break; case 1: //if there are no supply and progress if (useThis.orders[0].progress == 0 && business.workStations[useThis.extra[0]].orders[0].wants[1] == 0) { return; } //set the amount of focus that the player has in this station tempFocus = player.focus[place]; //creates the amount of progress in the last update taking into account the focus multiplyer tempProgress = (tempFocus * player.playerEmployee.focusMultiplyer[place] * Time.deltaTime) / (useThis.timeMain / player.playerEmployee.timeMultiplyer[place]); //adds the progresses together to get the current progress tempProgress = tempProgress + useThis.orders[0].progress; //for orders if the taken value is false it means that the products for that order have not been removed if (useThis.orders[0].taken == false) { if (business.workStations[useThis.extra[0]].orders[0].wants[1] == 0) { tempProgress = 0; } else { business.workStations[useThis.extra[0]].orders[0].wants[1] = business.workStations[useThis.extra[0]].orders[0].wants[1] - 1; useThis.orders[0].taken = true; } } //if the progress is greater than one if (tempProgress >= 1) { // makes a new number to be the amount of times the bar was filled tempNumber = (int)Mathf.Floor(tempProgress); //make new variable to hold the progress less than 1 tempProgress = tempProgress - tempNumber; //this code is not very nice and i will redo it the future, basically if it went though more than once take for each time through useThis.orders[0].wants[1] = useThis.orders[0].wants[1] + 1; if (business.workStations[useThis.extra[0]].orders[0].wants[1] == 0) { tempProgress = 0; useThis.orders[0].taken = false; } else { business.workStations[useThis.extra[0]].orders[0].wants[1] = business.workStations[useThis.extra[0]].orders[0].wants[1] - 1; useThis.orders[0].taken = true; } if (tempNumber == 2) { if (business.workStations[useThis.extra[0]].orders[0].wants[1] == 0) { tempProgress = 0; useThis.orders[0].taken = false; } else { business.workStations[useThis.extra[0]].orders[0].wants[1] = business.workStations[useThis.extra[0]].orders[0].wants[1] - 1; useThis.orders[0].wants[1] = useThis.orders[0].wants[1] + 1; } } } useThis.slider.value = tempProgress; useThis.orders[0].progress = tempProgress; upDateAmount(place); upDateAmount(useThis.extra[0]); break; case 2: //if there are no customers and progress if (useThis.orders.Count == 0) { return; } //if there are no supply and progress if (useThis.orders[0].progress == 0 && business.workStations[useThis.extra[0]].orders[0].wants[1] == 0) { return; } //set the amount of focus that the player has in this station tempFocus = player.focus[place]; //creates the amount of progress in the last update taking into account the focus multiplyer tempProgress = (tempFocus * player.playerEmployee.focusMultiplyer[place] * Time.deltaTime) / (useThis.timeMain / player.playerEmployee.timeMultiplyer[place]); //adds the progresses together to get the current progress tempProgress = tempProgress + useThis.orders[0].progress; //take away one of the customers and used object since the bar has no progress if (useThis.orders[0].taken == false) { if (business.workStations[useThis.extra[0]].orders[0].wants[1] == 0) { tempProgress = 0; } else { business.workStations[useThis.extra[0]].orders[0].wants[1] = business.workStations[useThis.extra[0]].orders[0].wants[1] - 1; useThis.orders[0].taken = true; } } //if the progress is greater than one if (tempProgress >= 1) { // makes a new number to be the amount of times the bar was filled tempNumber = (int)Mathf.Floor(tempProgress); //make new variable to hold the progress less than 1 tempProgress = tempProgress - tempNumber; useThis.orders.RemoveAt(0); addToCustomers(1); //this code is not very nice and i will redo it the future, basically if it went though more than once take for each time through if (useThis.orders.Count == 0) { tempProgress = 0; } else if (business.workStations[useThis.extra[0]].orders[0].wants[1] == 0) { tempProgress = 0; useThis.orders[0].taken = false; } else { business.workStations[useThis.extra[0]].orders[0].wants[1] = business.workStations[useThis.extra[0]].orders[0].wants[1] - 1; useThis.orders[0].taken = true; } if (tempNumber == 2) { if (useThis.orders.Count == 0) { tempProgress = 0; } else if (business.workStations[useThis.extra[0]].orders[0].wants[1] == 0) { tempProgress = 0; useThis.orders[0].taken = false; } else { business.workStations[useThis.extra[0]].orders[0].wants[1] = business.workStations[useThis.extra[0]].orders[0].wants[1] - 1; useThis.orders.RemoveAt(0); addToCustomers(1); } } } useThis.slider.value = tempProgress; if (useThis.orders.Count > 0) { useThis.orders[0].progress = tempProgress; } upDateAmount(place); upDateAmount(useThis.extra[0]); break; case 3: /* * //if there are no customers and progress * if (useThis.progress == 0 && useThis.amountWaiting == 0) * { * return; * } * * //add 10 to the focus amount if this workplace is being run * int tempFocus3 = useThis.focus; * if (business.isRunning == place) * { * tempFocus3 = tempFocus3 + 10; * } * * //creates the amount of progress in the last update taking into account the focus multiplyer * float tempProgress3 = (tempFocus3 * player.focusMultiplyer[place] * Time.deltaTime) / (useThis.timeMain / player.timeMultiplyer[place]); * //adds the progresses together to get the current progress * tempProgress3 = tempProgress3 + useThis.progress; * * //take away one of the customers and used object since the bar has no progress * if (useThis.progress == 0) * { * useThis.amountWaiting = useThis.amountWaiting - 1; * } * * //if the progress is greater than one * if (tempProgress3 >= 1) * { * // makes a new number to be the amount of times the bar was filled * int tempNumber3 = (int)Mathf.Floor(tempProgress3); * * //make new variable to hold the progress less than 1 * tempProgress3 = tempProgress3 - tempNumber3; * int amountToUse3; * //if it went though more times then there are customers * if (tempNumber3 > useThis.amountWaiting) * { * amountToUse3 = useThis.amountWaiting; * addToCustomers(amountToUse3 + 1); * tempProgress3 = 0; * } * //if the amount it went though was the correct amount * else * { * amountToUse3 = tempNumber3; * addToCustomers(tempNumber3); * } * useThis.amountWaiting = useThis.amountWaiting - amountToUse3; * } * useThis.slider.value = tempProgress3; * useThis.progress = tempProgress3; * upDateAmount(place); */ break; case 4: //set the amount of focus that the player has tempFocus = player.focus[place]; //creates the amount of progress in the last update taking into account the focus multiplyer tempProgress = (tempFocus * player.playerEmployee.focusMultiplyer[place] * Time.deltaTime) / (useThis.timeMain / player.playerEmployee.timeMultiplyer[place]); //adds the progresses together to get the current progress tempProgress = useThis.orders[0].progress - tempProgress; //the store is fully clean or maintained if (useThis.orders[0].progress == 0 && useThis.orders[0].wants[0] == 0) { return; } if (tempProgress < 0) { tempProgress = Mathf.Abs(tempProgress); // makes a new number to be the amount of times the bar was filled tempNumber = (int)Mathf.Floor(tempProgress) + 1; //make new variable to hold the progress less than 1 tempProgress = tempProgress % 1; tempProgress = 1 - tempProgress; //if the amount is full stop at full if (useThis.orders[0].wants[0] == 0) { tempProgress = 0; } else { //subtract the amount and update happiness useThis.orders[0].wants[0] = useThis.orders[0].wants[0] - tempNumber; business.negativeHappiness[place] = useThis.orders[0].wants[0]; if (business.negativeHappiness[place] < 0) { business.negativeHappiness[place] = 0; } updateHappiness(); } upDateAmount(place); } useThis.slider.value = tempProgress; useThis.orders[0].progress = tempProgress; break; case 5: /* * //calculate progress since last update and add to the exsisting progress * float tempProgress5 = (business.customerIncrease * Time.deltaTime) / (useThis.extra[0] / player.timeMultiplyer[place]); * tempProgress5 = useThis.progress - tempProgress5; * int tempNumber5 = 0; * * if (useThis.running == true) * { * //add focuse if it is being run by player * int tempFocus5 = useThis.focus; * if (business.isRunning == place) * { * tempFocus5 = tempFocus5 + 10; * } * * //update the progress based on the amount of work that is being done * tempProgress5 = tempProgress5 + ((tempFocus5 * player.focusMultiplyer[place] * Time.deltaTime) / (useThis.timeMain / player.timeMultiplyer[place])); * } * * //the store is fully stocked or maintained * if (useThis.progress == 1 && useThis.amountWaiting == 100 && tempProgress5 < 0) * { * return; * } * * //the store is fully unstocked or unmaintained * if (useThis.progress == 0 && useThis.amountWaiting == 0 && tempProgress5 > 0) * { * return; * } * * if (tempProgress5 >= 1) * { * // makes a new number to be the amount of times the bar was filled * tempNumber5 = (int)Mathf.Floor(tempProgress5); * * //make new variable to hold the progress less than 1 * tempProgress5 = tempProgress5 - tempNumber5; * * //if the amount is full stop at full * if (useThis.amountWaiting == 100) * { * tempProgress5 = 1; * } * else * { * //add the amount and update happiness * useThis.amountWaiting = useThis.amountWaiting + tempNumber5; * business.negativeHappiness[place] = 100 - useThis.amountWaiting; * if (business.negativeHappiness[place] < 0) * { * business.negativeHappiness[place] = 0; * } * updateHappiness(); * } * upDateAmount(place); * } * * if (tempProgress5 < 0) * { * tempProgress5 = Mathf.Abs(tempProgress5); * // makes a new number to be the amount of times the bar was filled * tempNumber5 = (int)Mathf.Floor(tempProgress5) + 1; * * //make new variable to hold the progress less than 1 * tempProgress5 = tempProgress5 % 1; * tempProgress5 = 1 - tempProgress5; * * //if the amount if full stop at full * if (useThis.amountWaiting == 0) * { * tempProgress5 = 0; * } * else * { * //subtract the amount and update happiness * useThis.amountWaiting = useThis.amountWaiting - tempNumber5; * business.negativeHappiness[place] = 100 - useThis.amountWaiting; * if (business.negativeHappiness[place] > 50) * { * business.negativeHappiness[place] = 50; * } * updateHappiness(); * } * upDateAmount(place); * } * useThis.slider.value = tempProgress5; * useThis.progress = tempProgress5; */ break; case 6: /* * //if the store is fully supplied/maintained * if (useThis.progress == 1 && useThis.amountWaiting == 100) * { * return; * } * * //if there are no goods waiting * if (useThis.extra[2] == 0 && business.workStations[useThis.extra[0]].amountWaiting == 0) * { * return; * } * * //add 10 to the focus amount if this workplace is being run * int tempFocus6 = useThis.focus; * if (business.isRunning == place) * { * tempFocus6 = tempFocus6 + 10; * } * * //creates the amount of progress in the last update taking into account the multiplyers * float thisProgress6 = (tempFocus6 * player.focusMultiplyer[place] * Time.deltaTime) / (useThis.timeMain / player.timeMultiplyer[place]); * //adds the progresses together to get the current progress * float tempProgress6 = thisProgress6 + useThis.progress; * int tempNumber6 = 0; * * if (thisProgress6 > (float)useThis.extra[2] / 1000000) * { * tempProgress6 = thisProgress6 - ((float)useThis.extra[2] / 1000000); * // makes a new number to be the amount of times the bar was filled * tempNumber6 = (int)Mathf.Ceil(tempProgress6); * * if (tempNumber6 > business.workStations[useThis.extra[0]].amountWaiting) * { * tempNumber6 = business.workStations[useThis.extra[0]].amountWaiting; * useThis.extra[2] = useThis.extra[2] + (1000000 * tempNumber6); * tempProgress6 = useThis.progress + ((float)useThis.extra[2] / 1000000F); * useThis.extra[2] = 0; * } * else * { * business.workStations[useThis.extra[0]].amountWaiting = business.workStations[useThis.extra[0]].amountWaiting - tempNumber6; * tempProgress6 = useThis.progress + thisProgress6; * useThis.extra[2] = (useThis.extra[2] + (1000000 * tempNumber6)) - (int)(thisProgress6 * 1000000F); * } * } * else * { * useThis.extra[2] = useThis.extra[2] - (int)(thisProgress6 * 1000000); * } * * if (tempProgress6 >= 1) * { * // makes a new number to be the amount of times the bar was filled * tempNumber6 = (int)Mathf.Floor(tempProgress6); * * //make new variable to hold the progress less than 1 * tempProgress6 = tempProgress6 - tempNumber6; * useThis.amountWaiting = useThis.amountWaiting + tempNumber6; * setHappinessForUses(useThis.amountWaiting); * if (useThis.amountWaiting > 100) * { * useThis.extra[2] = useThis.extra[2] + (int)(tempProgress6 * 1000000F); * tempProgress6 = 1; * useThis.amountWaiting = 100; * } * } * useThis.slider.value = tempProgress6; * useThis.progress = tempProgress6; * upDateAmount(place); * upDateAmount(useThis.extra[0]); */ break; case 7: if (useThis.orders.Count == 0) { return; } //set the amount of focus that the player has in this station tempFocus = player.focus[place]; //creates the amount of progress in the last update taking into account the focus multiplyer tempProgress = (tempFocus * player.playerEmployee.focusMultiplyer[place] * Time.deltaTime) / (useThis.orders[0].wants[1] / player.playerEmployee.timeMultiplyer[place]); //adds the progresses together to get the current progress tempProgress = tempProgress + useThis.orders[0].progress; //when the current training has been finished if (tempProgress > 1) { trainingCS.finishTraining(); useThis.orders.RemoveAt(0); tempProgress = tempProgress - 1; } //if there is training add the progress to the next training if (useThis.orders.Count != 0) { useThis.slider.value = tempProgress; useThis.orders[0].progress = tempProgress; } //if there is no more training else { useThis.slider.value = 0; selectionChange(player.playerEmployee.wasWorkingIn); } break; } }
//run the work stations for each employee - needs work private void updateStations(int station, workStation useThis, employee employee, float decreaseAmount, int place) { int tempFocus; int tempNumber; float tempProgress; switch (useThis.type) { case 0: /* * //creates the amount of progress in the last update taking into account the focus multiplyer * float tempProgress0 = (focus * employee.focusMultiplyer[place] * Time.deltaTime * (player.skillPercent[0]/100F) * decreaseAmount) / (useThis.timeMain / employee.timeMultiplyer[place]); * * //adds the progresses together to get the current progress * tempProgress0 = tempProgress0 + employee.progress; * * if (tempProgress0 >= 1) * { * // makes a new number to be the amount of times the bar was filled * int tempNumber0 = (int)Mathf.Floor(tempProgress0); * * //make new variable to hold the progress less than 1 * tempProgress0 = tempProgress0 - tempNumber0; * useThis.amountWaiting = useThis.amountWaiting + tempNumber0; * upDateAmount(place, employee); * } * employee.slider.value = tempProgress0; * employee.progress = tempProgress0; * break; * case 1: * //if there are no supply and progress * if (employee.progress == 0 && business.workStations[useThis.extra[0]].amountWaiting == 0) * { * return; * } * * //creates the amount of progress in the last update taking into account the focus multiplyer * float tempProgress1 = (focus * employee.focusMultiplyer[place] * Time.deltaTime * (player.skillPercent[0] / 100F) * decreaseAmount) / (useThis.timeMain / employee.timeMultiplyer[place]); * * //adds the progresses together to get the current progress * tempProgress1 = tempProgress1 + employee.progress; * * //take away one used object since the bar has no progress * if (employee.progress == 0) * { * business.workStations[useThis.extra[0]].amountWaiting = business.workStations[useThis.extra[0]].amountWaiting - 1; * } * * //if the progress is greater than one * if (tempProgress1 >= 1) * { * // makes a new number to be the amount of times the bar was filled * int tempNumber1 = (int)Mathf.Floor(tempProgress1); * * //make new variable to hold the progress less than 1 * tempProgress1 = tempProgress1 - tempNumber1; * int amountToUse1; * //if it went though more times then there are used amount * if (tempNumber1 > business.workStations[useThis.extra[0]].amountWaiting) * { * amountToUse1 = business.workStations[useThis.extra[0]].amountWaiting + 1; * business.workStations[useThis.extra[0]].amountWaiting = business.workStations[useThis.extra[0]].amountWaiting - (amountToUse1 - 1); * tempProgress1 = 0; * } * //if the amount it went though was the correct amount * else * { * amountToUse1 = tempNumber1; * business.workStations[useThis.extra[0]].amountWaiting = business.workStations[useThis.extra[0]].amountWaiting - amountToUse1; * } * useThis.amountWaiting = useThis.amountWaiting + amountToUse1; * } * employee.slider.value = tempProgress1; * employee.progress = tempProgress1; * upDateAmount(place,employee); * upDateAmount(useThis.extra[0],employee); */ break; case 2: /* * //if there are no supply and progress * if (employee.progress == 0 && business.workStations[useThis.extra[0]].amountWaiting == 0) * { * return; * } * * //if there are no customers and progress * if (employee.progress == 0 && useThis.amountWaiting == 0) * { * return; * } * * //creates the amount of progress in the last update taking into account the focus multiplyer * float tempProgress2 = (focus * employee.focusMultiplyer[place] * Time.deltaTime * (player.skillPercent[0] / 100F) * decreaseAmount) / (useThis.timeMain / employee.timeMultiplyer[place]); * * //adds the progresses together to get the current progress * tempProgress2 = tempProgress2 + employee.progress; * * //take away one of the customers and used object since the bar has no progress * if (employee.progress == 0) * { * business.workStations[useThis.extra[0]].amountWaiting = business.workStations[useThis.extra[0]].amountWaiting - 1; * useThis.amountWaiting = useThis.amountWaiting - 1; * } * * //if the progress is greater than one * if (tempProgress2 >= 1) * { * // makes a new number to be the amount of times the bar was filled * int tempNumber2 = (int)Mathf.Floor(tempProgress2); * * //make new variable to hold the progress less than 1 * tempProgress2 = tempProgress2 - tempNumber2; * int amountToUse2; * //if it went though more times then there are customers * if (tempNumber2 > useThis.amountWaiting) * { * amountToUse2 = useThis.amountWaiting; * addToCustomers(amountToUse2 + 1); * tempProgress2 = 0; * } * //if it went though more times then there are used amount * else if (tempNumber2 > business.workStations[useThis.extra[0]].amountWaiting) * { * amountToUse2 = business.workStations[useThis.extra[0]].amountWaiting; * addToCustomers(amountToUse2 + 1); * tempProgress2 = 0; * } * //if the amount it went though was the correct amount * else * { * amountToUse2 = tempNumber2; * addToCustomers(tempNumber2); * } * useThis.amountWaiting = useThis.amountWaiting - amountToUse2; * business.workStations[useThis.extra[0]].amountWaiting = business.workStations[useThis.extra[0]].amountWaiting - amountToUse2; * } * employee.slider.value = tempProgress2; * employee.progress = tempProgress2; * upDateAmount(place,employee); * upDateAmount(useThis.extra[0],employee); */ break; case 3: /* * //if there are no customers and progress * if (useThis.progress == 0 && useThis.amountWaiting == 0) * { * return; * } * * //creates the amount of progress in the last update taking into account the focus multiplyer * float tempProgress3 = (focus * employee.focusMultiplyer[place] * Time.deltaTime * (player.skillPercent[0] / 100F) * decreaseAmount) / (useThis.timeMain / employee.timeMultiplyer[place]); * * //adds the progresses together to get the current progress * tempProgress3 = tempProgress3 + employee.progress; * * //take away one of the customers and used object since the bar has no progress * if (employee.progress == 0) * { * useThis.amountWaiting = useThis.amountWaiting - 1; * } * * //if the progress is greater than one * if (tempProgress3 >= 1) * { * // makes a new number to be the amount of times the bar was filled * int tempNumber3 = (int)Mathf.Floor(tempProgress3); * * //make new variable to hold the progress less than 1 * tempProgress3 = tempProgress3 - tempNumber3; * int amountToUse3; * //if it went though more times then there are customers * if (tempNumber3 > useThis.amountWaiting) * { * amountToUse3 = useThis.amountWaiting; * addToCustomers(amountToUse3 + 1); * tempProgress3 = 0; * } * //if the amount it went though was the correct amount * else * { * amountToUse3 = tempNumber3; * addToCustomers(tempNumber3); * } * useThis.amountWaiting = useThis.amountWaiting - amountToUse3; * } * employee.slider.value = tempProgress3; * employee.progress = tempProgress3; * upDateAmount(place,employee); */ break; case 4: if (employee.task == null) { employee.task = useThis.orders[0]; } else if (employee.task.name != useThis.orders[0].name) { employee.task = useThis.orders[0]; } //set the amount of focus that the employee has tempFocus = employee.focus; //creates the amount of progress in the last update taking into account the focus multiplyer tempProgress = ((tempFocus * employee.focusMultiplyer[station] * Time.deltaTime) / (useThis.timeMain / employee.timeMultiplyer[station])) * decreaseAmount * (player.skillPercent[0] / 100F); tempProgress = tempProgress * getWorkForHappiness(employee); if (player.playerEmployee.workingIn == station) { tempProgress = tempProgress * ((100 + player.percentEffect) / 100F); } //adds the progresses together to get the current progress tempProgress = useThis.orders[0].progress - tempProgress; //the store is fully clean or maintained if (useThis.orders[0].progress == 0 && useThis.orders[0].wants[0] == 0) { return; } if (tempProgress < 0) { tempProgress = Mathf.Abs(tempProgress); // makes a new number to be the amount of times the bar was filled tempNumber = (int)Mathf.Floor(tempProgress) + 1; //make new variable to hold the progress less than 1 tempProgress = tempProgress % 1; tempProgress = 1 - tempProgress; //if the amount is full stop at full if (useThis.orders[0].wants[0] == 0) { tempProgress = 0; } else { //subtract the amount and update happiness useThis.orders[0].wants[0] = useThis.orders[0].wants[0] - tempNumber; business.negativeHappiness[station] = useThis.orders[0].wants[0]; if (business.negativeHappiness[station] < 0) { business.negativeHappiness[station] = 0; } updateHappiness(); } } employee.task.progress = tempProgress; break; case 5: /* * //calculate progress since last update and add to the exsisting progress * float tempProgress5 = (business.customerIncrease * Time.deltaTime) / (useThis.extra[0] / player.timeMultiplyer[place]); * tempProgress5 = useThis.progress - tempProgress5; * int tempNumber5 = 0; * * if (useThis.running == true) * { * //add focuse if it is being run by player * int tempFocus5 = useThis.focus; * if (business.isRunning == place) * { * tempFocus5 = tempFocus5 + 10; * } * * //update the progress based on the amount of work that is being done * tempProgress5 = tempProgress5 + ((tempFocus5 * player.focusMultiplyer[place] * Time.deltaTime) / (useThis.timeMain / player.timeMultiplyer[place])); * } * * //the store is fully stocked or maintained * if (useThis.progress == 1 && useThis.amountWaiting == 100 && tempProgress5 < 0) * { * return; * } * * //the store is fully unstocked or unmaintained * if (useThis.progress == 0 && useThis.amountWaiting == 0 && tempProgress5 > 0) * { * return; * } * * if (tempProgress5 >= 1) * { * // makes a new number to be the amount of times the bar was filled * tempNumber5 = (int)Mathf.Floor(tempProgress5); * * //make new variable to hold the progress less than 1 * tempProgress5 = tempProgress5 - tempNumber5; * * //if the amount is full stop at full * if (useThis.amountWaiting == 100) * { * tempProgress5 = 1; * } * else * { * //add the amount and update happiness * useThis.amountWaiting = useThis.amountWaiting + tempNumber5; * business.negativeHappiness[place] = 100 - useThis.amountWaiting; * if (business.negativeHappiness[place] < 0) * { * business.negativeHappiness[place] = 0; * } * updateHappiness(); * } * upDateAmount(place); * } * * if (tempProgress5 < 0) * { * tempProgress5 = Mathf.Abs(tempProgress5); * // makes a new number to be the amount of times the bar was filled * tempNumber5 = (int)Mathf.Floor(tempProgress5) + 1; * * //make new variable to hold the progress less than 1 * tempProgress5 = tempProgress5 % 1; * tempProgress5 = 1 - tempProgress5; * * //if the amount if full stop at full * if (useThis.amountWaiting == 0) * { * tempProgress5 = 0; * } * else * { * //subtract the amount and update happiness * useThis.amountWaiting = useThis.amountWaiting - tempNumber5; * business.negativeHappiness[place] = 100 - useThis.amountWaiting; * if (business.negativeHappiness[place] > 50) * { * business.negativeHappiness[place] = 50; * } * updateHappiness(); * } * upDateAmount(place); * } * useThis.slider.value = tempProgress5; * useThis.progress = tempProgress5; */ break; case 6: /* * //if the store is fully supplied/maintained * if (useThis.progress == 1 && useThis.amountWaiting == 100) * { * return; * } * * //if there are no goods waiting * if (useThis.extra[2] == 0 && business.workStations[useThis.extra[0]].amountWaiting == 0) * { * return; * } * * //add 10 to the focus amount if this workplace is being run * int tempFocus6 = useThis.focus; * if (business.isRunning == place) * { * tempFocus6 = tempFocus6 + 10; * } * * //creates the amount of progress in the last update taking into account the multiplyers * float thisProgress6 = (tempFocus6 * player.focusMultiplyer[place] * Time.deltaTime) / (useThis.timeMain / player.timeMultiplyer[place]); * //adds the progresses together to get the current progress * float tempProgress6 = thisProgress6 + useThis.progress; * int tempNumber6 = 0; * * if (thisProgress6 > (float)useThis.extra[2] / 1000000) * { * tempProgress6 = thisProgress6 - ((float)useThis.extra[2] / 1000000); * // makes a new number to be the amount of times the bar was filled * tempNumber6 = (int)Mathf.Ceil(tempProgress6); * * if (tempNumber6 > business.workStations[useThis.extra[0]].amountWaiting) * { * tempNumber6 = business.workStations[useThis.extra[0]].amountWaiting; * useThis.extra[2] = useThis.extra[2] + (1000000 * tempNumber6); * tempProgress6 = useThis.progress + ((float)useThis.extra[2] / 1000000F); * useThis.extra[2] = 0; * } * else * { * business.workStations[useThis.extra[0]].amountWaiting = business.workStations[useThis.extra[0]].amountWaiting - tempNumber6; * tempProgress6 = useThis.progress + thisProgress6; * useThis.extra[2] = (useThis.extra[2] + (1000000 * tempNumber6)) - (int)(thisProgress6 * 1000000F); * } * } * else * { * useThis.extra[2] = useThis.extra[2] - (int)(thisProgress6 * 1000000); * } * * if (tempProgress6 >= 1) * { * // makes a new number to be the amount of times the bar was filled * tempNumber6 = (int)Mathf.Floor(tempProgress6); * * //make new variable to hold the progress less than 1 * tempProgress6 = tempProgress6 - tempNumber6; * useThis.amountWaiting = useThis.amountWaiting + tempNumber6; * setHappinessForUses(useThis.amountWaiting); * if (useThis.amountWaiting > 100) * { * useThis.extra[2] = useThis.extra[2] + (int)(tempProgress6 * 1000000F); * tempProgress6 = 1; * useThis.amountWaiting = 100; * } * } * useThis.slider.value = tempProgress6; * useThis.progress = tempProgress6; * upDateAmount(place); * upDateAmount(useThis.extra[0]); */ break; case 7: if (employee.trainingQ.Count == 0) { return; } //set the amount of focus that the employee has tempFocus = employee.focus; //creates the amount of progress in the last update taking into account the focus multiplyer tempProgress = ((tempFocus * employee.focusMultiplyer[station] * Time.deltaTime) / (employee.trainingQ[0].wants[1] / employee.timeMultiplyer[station])) * decreaseAmount * (player.skillPercent[0] / 100F); //adds the progresses together to get the current progress tempProgress = tempProgress * getWorkForHappiness(employee); if (player.playerEmployee.workingIn == station) { tempProgress = tempProgress * ((100 + player.percentEffect) / 100F); } tempProgress = tempProgress + employee.trainingQ[0].progress; if (tempProgress > 1) { int iteam = employee.trainingQ[0].wants[0]; for (short x = 0; x < business.iteamList[iteam].affectAreas.Length; x++) { int tempInt = business.iteamList[iteam].affectAreas[x]; employee.timeMultiplyer[tempInt] = employee.timeMultiplyer[tempInt] + (business.iteamList[iteam].affectAmount / 100F); } employee.trainingQ.RemoveAt(0); if (currentlySelected == -1) { //do nothing } else if (business.employeesInfo[currentlySelected] == employee) { trainingMenuEmployee.GetComponent <TrainingEmployee>().setUp(currentlySelected); } tempProgress = tempProgress - 1; } if (employee.trainingQ.Count != 0) { employee.slider.value = tempProgress; employee.trainingQ[0].progress = tempProgress; } else { employee.slider.value = 0; if (business.workStations[employee.wasWorkingIn].EmployeeSpace != 0) { changeEmployeeStation(place, employee.wasWorkingIn); employee.workingIn = employee.wasWorkingIn; } } break; } }