public void ResetChefDetails(ChefDetails chef) { chef.GetComponent <ChefDetails>().pickedVegetables.Clear(); chef.GetComponent <ChefDetails>().pickedTwoVegetableSalad = null; chef.GetComponent <ChefDetails>().pickedThreeVegetableSalad = null; chef.GetComponent <ChefMovement>().currentlyChoppingIngredient = null; chef.GetComponent <ChefMovement>().listOfChoppedIngredients.Clear(); }
public void spawnRandomPickup(ChefDetails chef) { GameObject randomPickup = pickupsList[UnityEngine.Random.Range(0, pickupsList.Count)]; Vector3 randomPosition = new Vector3(UnityEngine.Random.Range(-450f, 450f), UnityEngine.Random.Range(-500f, -200f), 0f); randomPickup.GetComponent <ObjectType>().chef = chef; GameObject instantiatedPickup = Instantiate(randomPickup, transform.position, Quaternion.identity) as GameObject; instantiatedPickup.transform.SetParent(transform); instantiatedPickup.transform.localScale = new Vector3(2f, 2f, 2f); instantiatedPickup.transform.localPosition = randomPosition; }
public void orderRecieved(ChefDetails chef) { if (customerState == CUSTOMER_STATE.WAITING) { customerState = CUSTOMER_STATE.CHECKING; } if (twoVegetableSalad && !threeVegetableSalad) { if (recievedTwoVegetableSalad != null) { if (checkTwoVegetableSaladIngredients(recievedTwoVegetableSalad)) { customerState = CUSTOMER_STATE.RECIEVED; ResetCustomerOrder(); remainingWaitingTime = currentWaitingTime; currentWaitingTime = 0; chef.scriptableObjectForChef.playerScore += 5; if (remainingWaitingTime <= maximumWaitingTime) { spawnRandomPickup(chef); } } else { if (customerState == CUSTOMER_STATE.CHECKING) { customerState = CUSTOMER_STATE.ANGRY; currentWaitingTime = currentWaitingTime / 2; } else if (customerState == CUSTOMER_STATE.ANGRY) { customerState = CUSTOMER_STATE.NOT_RECIEVED; ResetCustomerOrder(); remainingWaitingTime = currentWaitingTime; currentWaitingTime = 0; chef.scriptableObjectForChef.playerScore -= 10; } } } else { if (customerState == CUSTOMER_STATE.CHECKING) { customerState = CUSTOMER_STATE.ANGRY; currentWaitingTime = currentWaitingTime / 2; } else if (customerState == CUSTOMER_STATE.ANGRY) { customerState = CUSTOMER_STATE.NOT_RECIEVED; ResetCustomerOrder(); remainingWaitingTime = currentWaitingTime; currentWaitingTime = 0; chef.scriptableObjectForChef.playerScore -= 10; } } } else if (!twoVegetableSalad && threeVegetableSalad) { if (recievedThreeVegetableSalad != null) { if (checkThreeVegetableSaladIngredients(recievedThreeVegetableSalad)) { customerState = CUSTOMER_STATE.RECIEVED; ResetCustomerOrder(); remainingWaitingTime = currentWaitingTime; currentWaitingTime = 0; chef.scriptableObjectForChef.playerScore += 5; if (remainingWaitingTime >= maximumWaitingTime * 0.7f) { spawnRandomPickup(chef); } } else { if (customerState == CUSTOMER_STATE.WAITING) { customerState = CUSTOMER_STATE.ANGRY; currentWaitingTime = currentWaitingTime / 2; } else if (customerState == CUSTOMER_STATE.ANGRY) { customerState = CUSTOMER_STATE.NOT_RECIEVED; ResetCustomerOrder(); remainingWaitingTime = currentWaitingTime; currentWaitingTime = 0; chef.scriptableObjectForChef.playerScore -= 10; } } } else { if (customerState == CUSTOMER_STATE.WAITING) { customerState = CUSTOMER_STATE.ANGRY; currentWaitingTime = currentWaitingTime / 2; } else if (customerState == CUSTOMER_STATE.ANGRY) { customerState = CUSTOMER_STATE.NOT_RECIEVED; ResetCustomerOrder(); remainingWaitingTime = currentWaitingTime; currentWaitingTime = 0; chef.scriptableObjectForChef.playerScore -= 10; } } } ResetChefDetails(chef); }