private void UpdateTimer() { if (CustomerTime <= 0) { foreach (PlayerController player in FindObjectsOfType <PlayerController>()) { player.ModifyScore(-20); messageController.DisplayMessage("Customer not served in time."); } DestroyCustomer(); } CustomerTime -= Time.deltaTime; CustomerTimer.GetComponent <TextMesh>().text = ((Math.Round(CustomerTime)).ToString() + "s"); }
IEnumerator DisplayMessages() { // first message messageController.DisplayMessage(0); yield return(new WaitForSeconds(3f)); // message after checking data if (dataExists) { messageController.DisplayMessage(3); checkingFinished = true; } else { messageController.DisplayMessage(1); yield return(new WaitForSeconds(3f)); messageController.DisplayMessage(2); checkingFinished = true; } }
private void PickObject(GameObject interactableObject) { if (Cart.Count >= 2) { // player cant have more than two items in the cart messageController.DisplayMessage("Cart full"); return; } if (interactableObject.CompareTag("Vegetable")) { // item is raw vege Cart.Add(interactableObject.transform.name); messageController.DisplayMessage($"{interactableObject.transform.name} added to Cart"); } else if (interactableObject.CompareTag(Constants.SaladTag)) { // item is salad Cart.Add(interactableObject.GetComponentInChildren <TextMesh>().text); Debug.Log(interactableObject.GetComponentInChildren <TextMesh>().text); messageController.DisplayMessage($"{interactableObject.GetComponentInChildren<TextMesh>().text} added to Cart"); Destroy(interactableObject); } }
public void MakeSalad(List <string> rawVege) { Debug.Log(rawVege.Count); if (mixerOutputEmpty.transform.childCount > 0) { // if previous output is on the transform, cancel current salad and return; return; } if (rawVege.Count <= 0) { return; } if (rawVege.Count == 1) { GameObject SaladOutputInstance = Instantiate(SaladOutput, mixerOutputEmpty.transform.position, Quaternion.identity); SaladOutputInstance.GetComponentInChildren <TextMesh>().text = rawVege[0]; } else if (rawVege.Count == 2) { if (rawVege[0].Equals(rawVege[1])) { InstantiateSalad(rawVege[0]); } else if (rawVege.Contains(Constants.Tomato) && rawVege.Contains(Constants.Brocolli)) { InstantiateSalad(Constants.Tomolli); } else if (rawVege.Contains(Constants.Tomato) && rawVege.Contains(Constants.Carrot)) { InstantiateSalad(Constants.Tarrot); } else if (rawVege.Contains(Constants.Brocolli) && rawVege.Contains(Constants.Carrot)) { InstantiateSalad(Constants.Brorrocolli); } else { messageController.DisplayMessage("Salad combination not found"); } } }
protected override void Update() { // functions common to all scenes base.Update(); // functions unique to this scene // if shake animation is finished if (animationEvents[0].finished) { // display dev name if (!messageController.getStartedValue()) { messageController.DisplayMessage(0); messageController.setStartedValue(true); } // load next scene if (messageController.getFinishedValue()) { StartCoroutine(base.LoadNextScene()); } } }