Skip to content

How To Sleep

Vadim Gromov edited this page Jan 10, 2021 · 9 revisions

All _gc references in these examples are instances of a IGameController

To make player sleep, call this method:

var forHowManyGameHours = 6f;
var realSeconds = 4f;

_gc.Body.Sleep(forHowManyGameHours, realSeconds, WokeUpCallback, ProgressTimeMethod);

...

private void WokeUpCallback(){
    // Is called when sleeping is completed
}

private void ProgressTimeMethod(DateTime newTime){
    // Is called number of times while sleeping to progress game time in a big chunks
    _gc.SetWorldTime(newTime); // some method that will update _gc.WorldTime property
}

Time is progressing during the sleeping, and health checks are still made -- so character can die in a sleep from a disease or blood loss for example. Some disease monitors are increasing chances of death when character is sleeping.

Sleep method will return false if player is not tired or cannot sleep because of the disease or medical agent effects.

Clone this wiki locally