/* * private void ShowRejoinder(){ * // Cria evento pro player de acordo com a resposta - player só vê a resposta, joga pra qualquer um dos lados, sem consequencia * } * * /* * private void ShowResults(){ * // Mostra resultados gerais do ciclo de debate * } */ private void GetPlayerAnswer() { if (uiBoolSlider.choice) // chose action accept { SetEventConsequences(currentQuestion.actionAccept, 0); currentQuestion = (DebateQuestion_Data)currentQuestion.actionAccept.nextEvent; Debug.Log("Player aceitou."); // Consequências de positivo } else { // chose action decline SetEventConsequences(currentQuestion.actionDecline, 0); currentQuestion = (DebateQuestion_Data)currentQuestion.actionDecline.nextEvent; Debug.Log("Player recusou."); // Consequências de negativo } }
private void QuestionAsked() { if (firstPlayer == 0) // Se o player perguntou { indexAux = uiCarousel.chosenList[0]; currentQuestion = debateQuestions[questionsIndex[indexAux]]; // Pergunta escolhida no carousel. debateQuestions.RemoveAt(questionsIndex[indexAux]); // IA escolhe resposta e exibe IAChooseAnswer(); ShowUIAnswer(); } else // Pega a resposta do player { GetPlayerAnswer(); ReturnControl(); } }
// Função principal de simulação de outros confrontos private void DebateSimulation() { ArrayList debatedCandidates = new ArrayList(); int oppa, oppb, lim; debatedCandidates.Add(opponentIndex); // Se o número de candidatos for par, a simulação é feita em n-1 candidatos. // Se o número de candidatos for ímpar, a simulação é feita em n-2 candidatos. if ((candidates.Count % 2) == 0) { lim = 1; } else { lim = 2; } while (debatedCandidates.Count < (candidates.Count - lim)) // Enquanto não simulou todos os embates // Sorteia oponente A { do { oppa = Random.Range(1, candidates.Count); } while(!debatedCandidates.Contains(oppa)); debatedCandidates.Add(oppa); // Sorteia oponente B do { oppb = Random.Range(1, candidates.Count); } while(!debatedCandidates.Contains(oppa)); debatedCandidates.Add(oppb); currentQuestion = debateQuestions[Random.Range(0, debateQuestions.Count)]; opponentIndex = oppa; IAChooseAnswer(); opponentIndex = oppb; IAChooseAnswer(); opponentIndex = oppa; IAChooseAnswer(); opponentIndex = oppb; IAChooseAnswer(); } }
private void IAChooseAnswer() { // TODO: IA escolhe a resposta int answer = Random.Range(0, 2); if (answer == 0) { SetEventConsequences(currentQuestion.actionAccept, opponentIndex); currentQuestion = (DebateQuestion_Data)currentQuestion.actionAccept.nextEvent; Debug.Log("IA aceitou"); } else { SetEventConsequences(currentQuestion.actionDecline, opponentIndex); currentQuestion = (DebateQuestion_Data)currentQuestion.actionDecline.nextEvent; Debug.Log("IA recusou."); } }
// Exclusivo para o evento de réplica private void GetPlayerReply() { if (uiBoolSlider.choice) // Faz propaganda { if (candidates[0].HasBoosts(currentQuestion.actionAccept)) // Boost { candidates[0].resources.credibility += credibilityBonus; } SetEventConsequences(currentQuestion.actionAccept, 0); currentQuestion = (DebateQuestion_Data)currentQuestion.actionAccept.nextEvent; Debug.Log("Player aceitou. (Ataque?)"); // Consequências de positivo } else // Faz ataque // FIXME - o quanto de credibilidade deve ser diminuído com base na corrupção dele? { candidates[opponentIndex].resources.credibility -= (candidates[opponentIndex].resources.corruption) / 2; // SetEventConsequences(currentQuestion.actionDecline, 0); currentQuestion = (DebateQuestion_Data)currentQuestion.actionDecline.nextEvent; Debug.Log("Player recusou. (Ataque?)"); // Consequências de negativo } }
private void AskQuestion() { if (firstPlayer == 0) // Se o player faz a pergunta //Sorteia 3 debate questions { List <GameObject> questions = new List <GameObject>(); //debateQuestions = debateQuestions.OrderBy(a => Random.Range(0f, 1000f)).ToList(); for (int i = 0; i < 3; i++) { // FIXME - tirar repetição int index = Random.Range(0, debateQuestions.Count); while (questionsIndex.Contains(index) && debateQuestions.Count >= 3) { index = Random.Range(0, debateQuestions.Count); } questionsIndex.Add(index); GameObject questionCard = (GameObject)Instantiate(debateQuestionPrefab); questionCard.GetComponent <EventBHV> ().Load(debateQuestions [index]); questions.Add(questionCard); } Debug.Log("Player faz primeira pergunta"); //poe no carrossel uiCarousel.SetCarouselActive(questions, 1); } else // Se a IA faz a pergunta // Gera o card com a pergunta { indexAux = Random.Range(0, debateQuestions.Count); currentQuestion = debateQuestions [indexAux]; GameObject questionCard = (GameObject)Instantiate(debateQuestionPrefab); questionCard.GetComponent <EventBHV> ().Load(currentQuestion); debateQuestions.RemoveAt(indexAux); Debug.Log("IA fez primeira pergunta."); // Envia o card para o Bool Action. uiBoolSlider.SetActiveBoolAction(questionCard); } }