IEnumerator Loading() { loading = true; loadPanel.SetActive(true); player.AllowMove(false); cam.AllowMove(false); Interact.allowInput = false; PauseM.HideCursor(); mainCam.enabled = true; loadtText.text = "Loading"; float t = UnityEngine.Random.Range(2, 5); mainCam.transform.rotation = Quaternion.identity; string dot = "."; while (t > 0) { t -= 1; loadtText.text += dot; yield return(new WaitForSeconds(1f)); } loadPanel.SetActive(false); yield return(new WaitForSeconds(1)); player.AllowMove(true); cam.AllowMove(true); Interact.allowInput = true; CheckAvailability(); StartCoroutine(BreakDown()); }
public IEnumerator EndOfShift() //end shift button on the log book { StartCoroutine(CameraPan(nextDay)); timer.text = ""; Interact.allowInput = false; //disabling interaction, resetting lists and varibales for next day player.AllowMove(false); cam.AllowMove(false); PauseM.ShowCursor(); mealAssesments.Clear(); endOfDayPanel.SetActive(true); double kCost = EndOfDayRestock(true) + Math.Round(daysEarnings / 10, 2); dayMoneySpent += kCost; endDayUI[0].text = "Day " + round.ToString(); //displaying day staistics endDayUI[1].text = "Todays Earnings: " + daysEarnings.ToString("£0.00"); endDayUI[3].text = "Todays Total Expenditure: " + dayMoneySpent.ToString("£0.00"); endDayUI[2].text = "Kitchen Clean and Staff Wages: " + kCost.ToString("-£0.00"); endDayUI[4].text = "Todays Profit: " + (daysEarnings - dayMoneySpent).ToString("£0.00"); endDayUI[5].text = "Meals Sent: " + mealsThrough.ToString(); foreach (Text t in endDayUI) { t.color = new Color(0, 0, 0, 0); } for (int i = 0; i < endDayUI.Length; i++) { if (i == 2) { StartCoroutine(UpdateMoney(-kCost, -.01)); } yield return(StartCoroutine(FadeIn(.9f, endDayUI[i]))); yield return(null); } if (currentCash <= 0) // when the player has no credit { foreach (Text t in endDayUI) { yield return(StartCoroutine(FadeOut(.8f, t))); } endDayUI[0].text = "You have gone bankrupt!"; yield return(StartCoroutine(FadeIn(1.2f, endDayUI[0]))); toMainButton.SetActive(true); } else { shop.interactable = true; nextDayB.interactable = true; } dayMoneySpent = 0; daysEarnings = 0; round++; mealsThrough = 0; }
public void Resume() //remume button { Time.timeScale = 1; paused = false; if (!endP || !bookP) { Interact.allowInput = true; cam.AllowMove(true); player.AllowMove(true); HideCursor(); } if (bookP) //checking if any panels are active { book.bookPanel.SetActive(true); bookP = false; cam.AllowMove(false); player.AllowMove(false); ShowCursor(); Interact.allowInput = false; } if (endP) { gameManager.endOfDayPanel.SetActive(true); endP = false; cam.AllowMove(false); player.AllowMove(false); ShowCursor(); Interact.allowInput = false; } if (tutorial) { tutPanel.SetActive(true); tutorial = false; } timeT.SetActive(true); moneyT.SetActive(true); pausePanel.SetActive(false); audioM.UnPauseAll(); }
public void OnClick(RaycastHit hit, Transform t) //bringing up the book panel { Interact.allowInput = false; //stopping input from interact script onMenu = false; bookPanel.SetActive(true); gameManager.assessmentPanel.SetActive(false); pc.AllowMove(false); //stopping the player from moving fpc.AllowMove(false); PauseM.ShowCursor(); dayText.text = "Feedback"; butText.text = "Menu"; if (gameManager.MealTickets().Count == 0 && gameManager.dayTime < 0)//checking if the player can end the shift { endShiftB.interactable = true; } else { endShiftB.interactable = false; } StartCoroutine(DaysMeals()); //showing feed back if any - default }