Example #1
0
 // Update is called once per frame
 public void UpdateState()
 {
     if (!isSleeping)
     {
         isSleeping  = true;
         currentTime = Time.fixedTime;
     }
     else
     {
         if (survivor.getSurvivorTiredness() < 90)
         {
             if (Time.fixedTime - currentTime >= 0.5f)
             {
                 survivor.setSurvivorTiredness(survivor.getSurvivorTiredness() + 10);
                 if (survivor.getSurvivorHealth() + 1 < 100)
                 {
                     survivor.setSurvivorHealth(survivor.getSurvivorHealth() + 1);
                 }
                 currentTime = Time.fixedTime;
             }
         }
         else
         {
             isSleeping = false;
             survivor.home.GetComponent <House>().setSign(0);
             ToHomeState();
         }
     }
 }