public static IPersonRoutine CreateHouseRoutines(Person person, Building house) { IPersonRoutine goHome = new PersonRoutineGoTo(() => true, house, person, PersonState.Goes); IPersonRoutine doRest = new PersonRoutineUntilCondition( startCondition: () => !Daytime.IsDay, finishCondition: () => house == null || Daytime.IsDayWL(person.laziness), PersonState.RestsAtHome, GetOnFinishResting(person)); return(new PersonRoutineGoToDo(() => goHome.CanStart() && doRest.CanStart(), person, goHome, doRest, null)); }
public static IPersonRoutine CreateJobRoutines(Person person, Job job) { IPersonRoutine goToWork = new PersonRoutineGoTo(() => true, job.Workplace, person, PersonState.Goes); IPersonRoutine doWork = new PersonRoutineUntilCondition( startCondition: () => Daytime.IsDay, finishCondition: () => job.Workplace == null || !Daytime.IsDayWL(person.laziness), PersonState.Works, doOnFinish: GetOnWorkFinish(job)); return(new PersonRoutineGoToDo(() => goToWork.CanStart() && doWork.CanStart(), person, goToWork, doWork, null)); }