// Update is called once per frame void Update() { string seconds1 = ""; timeStart += Time.deltaTime * 0.3f; string seconds = Mathf.Floor(timeStart % 60).ToString("00"); //actually minutes in our universe string minutes = Mathf.Floor(timeStart / 60).ToString("00"); //actually hours in our universe clock.text = minutes + " : " + seconds; if (seconds1 != seconds) { statsBars.ReduceSleep(0.0005f); statsBars.ReduceSpirit(0.0005f); } seconds1 = seconds; if (Int32.Parse(minutes) == 24) { timeStart = 0; /* * Change day of the week */ dayNum++; if (dayNum < 3) { dayName.text = weekDays[dayNum]; } } }
void PerformAction(string action) { //play animation after each action action = action.ToLower(); switch (action) { case "sleep": //perhaps it returns you to fully rested state statsBars.IncreaseSleep(1.0f); statsBars.ReduceSpirit(2.0f); clock.timeStart += 60f; PerformAnimation(action); break; case "nap": statsBars.IncreaseSleep(0.5f); statsBars.IncreaseSpirit(2.0f); clock.timeStart += 30f; PerformAnimation(action); break; case "work": statsBars.ReduceSleep(2.0f); statsBars.ReduceSanity(1.5f); clock.timeStart += 60f; PerformAnimation(action); break; case "research": statsBars.ReduceSanity(0.5f); statsBars.ReduceSleep(0.5f); clock.timeStart += 30f; PerformAnimation(action); SceneManager.LoadScene("Synonymous"); break; case "study": statsBars.ReduceSanity(0.5f); statsBars.ReduceSleep(0.5f); clock.timeStart += 30f; PerformAnimation(action); SceneManager.LoadScene("Conext"); break; case "read": statsBars.ReduceSanity(0.5f); statsBars.ReduceSleep(0.5f); clock.timeStart += 30f; PerformAnimation(action); break; case "play games": statsBars.IncreaseSanity(1.0f); statsBars.ReduceSleep(0.5f); clock.timeStart += 60f; PerformAnimation(action); break; case "submit": if (statsBars.CurrentProgress == 20f) { SceneManager.LoadScene("Submit"); } else { Debug.Log("YOU CANNOT SUBMIT!"); } break; default: break; } }