public char calculateLetterGrade(int percent)
 {
     if (percent >= 90)
     {
         return('a');
     }
     else if (percent >= 80)
     {
         BackgroundStats.changeStress(3);
         return('b');
     }
     else if (percent >= 60)
     {
         BackgroundStats.changeStress(7);
         return('c');
     }
     else if (percent >= 40)
     {
         BackgroundStats.changeStress(10);
         return('d');
     }
     else
     {
         BackgroundStats.changeStress(15);
         return('f');
     }
 }
示例#2
0
    //show how many hours are left
    public void displaySleepHours()
    {
        txt.enabled = true;
        int sleepHours = timer.getSleepHours();

        txt.text = "You got " + sleepHours + " hours of sleep.";
        BackgroundStats.changeStress(Mathf.Max(-(sleepHours - 6) * 6, -30));
    }
 //subtracts the stress every second
 private void changeStat()
 {
     temp += Time.deltaTime;
     if (temp >= 1)
     {
         BackgroundStats.changeStress(-2);
         temp = 0;
     }
 }
示例#4
0
 //changes the family stat based on isAngry and penaltyApplied
 void changeStressStat()
 {
     if (!penaltyApplied)
     {
         if (isAngry)
         {
             BackgroundStats.changeStress(penalty);
             Debug.Log("subtracted from family stat");
         }
         else
         {
             BackgroundStats.changeFamily(plus);
             Debug.Log("added to family stat");
         }
     }
 }
    // Update is called once per frame
    void Update()
    {
        if (!paused && active)
        {
            time += Time.deltaTime;
        }
        Debug.Log(time);

        if (active && time >= timeStart + length)
        {
            timerEnd();
            time = 0;
        }
        //Debug.Log (paused);
        //tester
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (!instructions)
            {
                pauseMenuToggle();
                pause();
            }
            else
            {
                instructionsToggle();
            }
        }

        //adds Stress Tick
        if (!addedStress && time % stressTick < 0.4)
        {
            Debug.Log("AAAaAAAA");
            BackgroundStats.changeStress(1);
            Debug.Log(bedtimeStressTick);
            Debug.Log("stress tick: " + stressTick);
            addedStress = true;
            if (bedtime)
            {
                time = 0;
            }
        }
        if (time % stressTick > 0.5)
        {
            addedStress = false;
        }
    }