Exemple #1
0
    public void UpdateUI()
    {
        //set statsBar values
        bars[0].value    = stats.PhysHealth;
        bars[1].value    = stats.MentHealth;
        bars[2].value    = stats.Nutri;
        bars[3].value    = stats.Hygiene;
        bars[4].value    = stats.Energy;
        bars[5].value    = stats.Ability;
        barTexts[0].text = ((int)stats.PhysHealth).ToString();
        barTexts[1].text = ((int)stats.MentHealth).ToString();
        barTexts[2].text = ((int)stats.Nutri).ToString();
        barTexts[3].text = ((int)stats.Hygiene).ToString();
        barTexts[4].text = ((int)stats.Energy).ToString();
        barTexts[5].text = ((int)stats.Ability).ToString();

        //update currentPhy to recap
        recap.setCurrentPhy(stats.PhysHealth);
        recap.setCurrentMen(stats.MentHealth);
        recap.setCurrentNutri(stats.Nutri);
        recap.setCurrentHygen(stats.Hygiene);
        recap.setCurrentAbility(stats.Ability);
        recap.setCurrentEnergy(stats.Energy);

        if (stats.PhysHealth == 0)
        {
            messageString = "You have been sent back to the hospital";
            showMessage();
        }
        else if (stats.MentHealth == 0)
        {
            messageString = "You have been sent back to the hospital";
            showMessage();
        }
        else if (dayNightController.getCurrentHour() == 23 && dayNightController.getCurrentMinute() == 0)
        {
            messageString = "It almost midnight...";
            showMessage();
        }
        else if (dayNightController.getCurrentHour() == 20 && dayNightController.getCurrentMinute() == 0)
        {
            messageString = "Buildings are closed in one hour.";
            showMessage();
        }
        else if (dayNightController.getCurrentHour() == 21 && dayNightController.getCurrentMinute() == 0)
        {
            messageString = "Buildings are closed... I should really go home!";
            showMessage();
            // TODO, reset day and send user back home
        }
        else if (dayNightController.getCurrentHour() == 19 && dayNightController.getCurrentMinute() == 0)
        {
            messageString = "It’s getting late I should get home soon...";
            showMessage();
        }
        else if (dayNightController.getCurrentHour() == 15 && dayNightController.getCurrentMinute() == 0)
        {
            messageString = "Oh boy! 3:00 PM Already?";
            showMessage();
        }
        else if (dayNightController.getCurrentHour() == 9 && dayNightController.getCurrentMinute() == 0)
        {
            messageString = "I could really go for some coffee right about now...";
            showMessage();
        }
        else if (stats.PhysHealth <= 60 && feelgoodPhy == false)
        {
            messageString = "I don’t feel so good!";
            feelgoodPhy   = true;
            showMessage();
        }
        else if (stats.MentHealth <= 60 && feelgoodMen == false)
        {
            messageString = "I don’t feel so good!";
            feelgoodMen   = true;
            showMessage();
        }
        else if (stats.Hygiene <= 40 && smell == false)
        {
            messageString = "I must smell really musty right now";
            smell         = true;
            showMessage();
        }
        else if (stats.Energy <= 40 && longday == false)
        {
            messageString = "Ugh,It’s been a long day";
            longday       = true;
            showMessage();
        }
        else if (stats.Nutri <= 40 && hungery == false)
        {
            messageString = "Man, I’m hungry! One burger can’t hurt that much";
            hungery       = true;
            showMessage();
        }
        else if (dayNightController.isInEvent())
        {
            messageString = "Doing event...";
            if (!messagePlane.gameObject.activeSelf)
            {
                messagePlane.gameObject.SetActive(true);
                message.text = messageString;
                SoundManager.PlayOneShot(notificationSound);
                doingEvent = true;
            }
        }
        else
        {
            if (doingEvent == true)
            {
                messagePlane.gameObject.SetActive(false);
                message.text  = "";
                messageString = "";
                doingEvent    = false;
            }
        }

        TimeText.text = "Time: " + dayNightController.getTime();
        //record the Stats when start a new day

        /*if(dayNightController.getCurrentHour() == 8 && dayNightController.getCurrentMinute() == 24){
         *  recap.setOldPhy(PhysHealth);
         * }*/
    }