public void TakeAnswer(TelegramBotClient bot, User currentUser, InlineKeyboardMarkup keyboard, int answer) { if (testPos <= tests.Count - 1) { if (tests[testPos].GetAnswer()[answer - 1]) { answerCount++; } testPos++; ShowTest(bot, currentUser.ChatID, keyboard); } else { if (answerCount >= tests.Count - 1) { bot.SendTextMessageAsync(currentUser.ChatID, $"Ви успішно пройшли тест!\nВи відповіли на {answerCount} питань з {tests.Count}."); answerCount = 0; testPos = 0; if (currentUser.Level < 10) { currentUser.LevelUp(); } XMLmanager.UpdateLevel(currentUser); } else if (answerCount < tests.Count - 1) { bot.SendTextMessageAsync(currentUser.ChatID, $"Ви не пройшли тест! Визвіть команду /study\nВи відповіли на {answerCount} питань з {tests.Count}."); answerCount = 0; testPos = 0; } } }
//collision between player to bus //Coins and Lives get values on collision from HUD private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.CompareTag("Player")) //if player touched end of level collider bus { Coins = scoreManager.score_manager.score; //getting current score and lives when player collied with finish bus Lives = LifesManager.GetLifes(); LevelIndex = CanPassToNextLevel(); //level index gets reference to build order scene to load if (LevelIndex > 0) { XMLmanager.UpdatePlayerDataOnNewLevel(); //Update XML when level fineshed //StartCoroutine(WaitForSceneLoad());//load level delay SceneManager.LoadScene(LevelIndex); //load level by offset index } } }
public void TakeAnswer(TelegramBotClient bot, User currentUser, ReplyKeyboardMarkup keyboard, int answer) { if (testPos <= tests.Count - 1) { if (tests[testPos].GetAnswer()[answer - 1]) { answerCount++; } testPos++; if (testPos > tests.Count - 1) { if ((((double)answerCount / tests.Count) * 100) >= 80) { bot.SendTextMessageAsync(currentUser.ChatID, $"✨ Ви успішно пройшли тест ✨\nВи відповіли на {answerCount} питань з {tests.Count}!", replyMarkup: new ReplyKeyboardRemove()); answerCount = 0; testPos = 0; if (currentUser.Level < 10) { currentUser.LevelUp(); if (currentUser.Level == 10) { bot.SendTextMessageAsync(currentUser.ChatID, "✨ Вітаємо з завершенням нашого курсу ✨ \nЩоб пройти курс заново, оберіть команду /reset."); } } XMLmanager.UpdateLevel(currentUser); } else if ((((double)answerCount / tests.Count) * 100) < 80) { bot.SendTextMessageAsync(currentUser.ChatID, $"😞 Ви не пройшли тест 😞\n Визвіть команду /study, щоб отримати лекцію знову.\nВи відповіли на {answerCount} питань з {tests.Count}.", replyMarkup: new ReplyKeyboardRemove()); answerCount = 0; testPos = 0; } } else { ShowTest(bot, currentUser.ChatID, keyboard); } } }