예제 #1
0
 private IEnumerator sleep(GameObject theBed)
 {
     if (theBed != null)
     {
         movescript.setpos(theBed.transform.position);
         yield return(new WaitUntil(() => theBed.GetComponent <Collider>().bounds.Contains(dwarfcontroller.transform.position)));
     }
     dwarfcontroller.setSleepStatut("Sleeping");
     dwarfcontroller.setcurrentjob(dwarfcontroller.getjob());
     dwarfcontroller.setjobstatut("on Break");
     dwarfcontroller.updateStatutText();
     Debug.Log(dwarfcontroller.getcurrentjob());
     if (theBed != null && dwarfcontroller.transform.position == theBed.transform.position)
     {
         yield return(new WaitForSeconds(sleepTime));
     }
     else   //Si il est pas sur le lit ou qu'il y a pas de lit, il dors deux fois plus longtemps
            //Et si t'es pas content c'est la même, t'avais qu'à faire un lit
     {
         yield return(new WaitForSeconds(sleepTime * 2));
     }
     dwarfcontroller.setSleepStatut("Awake");
     dwarfcontroller.isSleaping = false;
     dwarfcontroller.setjobstatut(dwarfcontroller.getcurrentjob());
     dwarfcontroller.updateStatutText();
     if (dwarfcontroller.getjobplace() != null)
     {
         Debug.Log(dwarfcontroller.getjobplace());
         dwarfcontroller.startwork();
     }
 }
예제 #2
0
    public IEnumerator sleep()
    {
        dwarfcontroller.setSleepStatut("Sleeping");
        dwarfcontroller.setcurrentjob(dwarfcontroller.getjob());
        dwarfcontroller.setjobstatut("on Break");
        dwarfcontroller.updateStatutText();
        Debug.Log(dwarfcontroller.getcurrentjob());
        yield return(new WaitForSeconds(sleepTime));

        dwarfcontroller.setSleepStatut("Awake");
        dwarfcontroller.setjobstatut(dwarfcontroller.getcurrentjob());
        dwarfcontroller.updateStatutText();
        if (dwarfcontroller.getjobplace() != null)
        {
            Debug.Log(dwarfcontroller.getjobplace());
            dwarfcontroller.startwork();
        }
    }
예제 #3
0
    IEnumerator digere()
    {
        yield return(new WaitForSeconds(eatduration));

        dwarfcontroller.setHungerStatus("satieted");
        Debug.Log("dwarf job : " + dwarfcontroller.getcurrentjob());
        dwarfcontroller.setjobstatut(dwarfcontroller.getcurrentjob());
        dwarfcontroller.updateStatutText();
        if (dwarfcontroller.getjobplace() != null && dwarfcontroller.getjob() != "idle")
        {
            dwarfcontroller.startwork();
        }
        movescript.setpos(dwarfcontroller.getPosBeforeEat());
        dwarfcontroller.iseating = false;
    }