void Handler::draw() { ofNoFill(); ofBackground(255); map->draw(); for (auto &gameObject : *gameObjects) { Building* build = dynamic_cast<Building*>(gameObject); if (build) { build->draw(); } } for (auto &gameObject : *gameObjects) { Creature* creat = dynamic_cast<Creature*>(gameObject); if (creat) { Person* pers = dynamic_cast<Person*>(creat); if (pers) { if (pers->getHunger() < 40) { pers->getFood(); } else { int time = ofGetElapsedTimeMillis(); if (time % 60000 >= 0 && time % 60000 <= 5000) { pers->sleep(); } else if (time % 60000 >= 6000 && time % 60000 <= 9000) { if (time % 2000 == 0) { pers->wander(); } } else { pers->doJob(); } } } else if ((int)ofGetElapsedTimef() % 5 == 0) { creat->wander(); } creat->draw(); } } guiHandler.draw(); }