virtual void doWith(const std::string ¶meter1, const std::string ¶meter2) const { Location *curLocation = player.getLocation() ; Object *curObject = curLocation->getObject(parameter1) ; if (curObject != NULL) { if (curObject->canTalk()) { if ((getStateFlag(FlagShishka)) == FVShishkaYes) { std::cout << "(" << curObject->getName() << ") Какой-то ты странный сегодня... Эй, ты чего смеёшься?\n" "(Вы) У-ха-ха-ха!! А-ха-ха-хах!! Это так смешно звучит, ой я не могу.. Аааа, мой мозг! А-ха-ха-хах!\n" "(" << curObject->getName() << ") Э-э-э-й! Ты тут вообще?..\n" "(Вы) Да... Да? Да! Тута я! Ля-ля-ля! Блин, как жрать хочу... Ку-ку!!!\n" "(" << curObject->getName() << ") О ужас! Ты выкурил шишку!!\n" "(Вы) Ку-кууу?...\n\n" "Через пару часов Вы успокоились и перестали нести чушь. Вас исключили из лагеря и вскоре Вас " "забрали домой родители. А вот нечего курить всякую гадость в лесу! " "Вы не смогли осуществить своих гениальных замыслов, игра закончена. До свидания!\n"; system("pause"); exitGame(); } curObject->talk(); } else std::cout << "Предметы не разговаривают!\n"; } else { std::cout << "Такого человека здесь нет!\n"; } }
virtual std::string getDescription() const { if (getStateFlag(FlagNight) == FVNightNo) { if (getStateFlag(FlagSerega) == FVSeregaAccept) return "Вы зашли в кабинет, на партах стоят ноутбуки, " "роботы и валяются кучи разных проводов. Детей нет – занятия уже закончились." "На западе выход из кабинета и учебного корпуса. "; else return "Вы зашли в кабинет, на партах стоят ноутбуки, " "роботы и валяются кучи разных проводов. За партами сидят дети, " "значит, занятия по робототехнике идут полным ходом. А вот и Сергей, вовсю рассказывает " "про программирование и логику роботов. На западе выход из кабинета и учебного корпуса."; } else return "Уже поздно и учебный корпус сейчас закрыт. Хотя это может быть и не так, но лучше это не проверять…"; }
virtual std::string getDescription() const { if (getStateFlag(FlagNight) == FVNightNo) return "Вы находитесь на веранде. На стене висит доска, " "на которой написаны части программ, решений и тому " "подобные вещи. На партах стоят ноутбуки, за одним из " "них сидит девушка из Вашего отряда – Ксюша. За вашей " "спиной, на севере, находится дверь, из которой вы пришли."; else return "Вы находитесь на веранде. На стене висит доска, " "на которой написаны части программ, решений и тому " "подобные вещи. За вашей " "спиной, на севере, находится дверь, из которой вы пришли."; }
bool Bounce::update() { unsetStateFlag(CHANGED_STATE); #ifdef BOUNCE_LOCK_OUT // Ignore everything if we are locked out if (millis() - previous_millis >= interval_millis) { bool currentState = readCurrentState(); if ( currentState != getStateFlag(DEBOUNCED_STATE) ) { previous_millis = millis(); changeState(); } } #elif defined BOUNCE_WITH_PROMPT_DETECTION // Read the state of the switch port into a temporary variable. bool readState = readCurrentState(); if ( readState != getStateFlag(DEBOUNCED_STATE) ) { // We have seen a change from the current button state. if ( millis() - previous_millis >= interval_millis ) { // We have passed the time threshold, so a new change of state is allowed. // set the STATE_CHANGED flag and the new DEBOUNCED_STATE. // This will be prompt as long as there has been greater than interval_misllis ms since last change of input. // Otherwise debounced state will not change again until bouncing is stable for the timeout period. changeState(); } } // If the readState is different from previous readState, reset the debounce timer - as input is still unstable // and we want to prevent new button state changes until the previous one has remained stable for the timeout. if ( readState != getStateFlag(UNSTABLE_STATE) ) { // Update Unstable Bit to macth readState toggleStateFlag(UNSTABLE_STATE); previous_millis = millis(); } #else // Read the state of the switch in a temporary variable. bool currentState = readCurrentState(); // If the reading is different from last reading, reset the debounce counter if ( currentState != getStateFlag(UNSTABLE_STATE) ) { previous_millis = millis(); toggleStateFlag(UNSTABLE_STATE); } else if ( millis() - previous_millis >= interval_millis ) { // We have passed the threshold time, so the input is now stable // If it is different from last state, set the STATE_CHANGED flag if (currentState != getStateFlag(DEBOUNCED_STATE) ) { previous_millis = millis(); changeState(); } } #endif return getStateFlag(CHANGED_STATE); }
bool Bounce::fell() { return !getStateFlag(DEBOUNCED_STATE) && getStateFlag(CHANGED_STATE); }
bool Bounce::rose() { return getStateFlag(DEBOUNCED_STATE) && getStateFlag(CHANGED_STATE); }
bool Bounce::read() { return getStateFlag(DEBOUNCED_STATE); }