public IEnumerator EndDay(int choice) { if (choice < 0) { ClearTextElements(); ClearTownspersonPic(); description.GetComponent <Text>().text = ChooseRandomStringFromArray(endDayStrings); } var livePeople = from person in people where !person.dead select person; //Everyone dead but one, go to the fight. textBacking.SetActive(true); //Needed when player timed out without having clicked on anything. yield return(new WaitForSeconds(8)); //Time to read the result if (livePeople.Count() == 1) { SceneManager.LoadScene("Battle"); yield break; } graveyard.SetActive(false); ClearTownspersonPic(); textBacking.SetActive(false); day = false; ClearTextElements(); fadeVal = new Color(0, 0, 0, 1f); fadeSprite.color = fadeVal; Text ont = overnightText.GetComponent <Text>(); ont.text = ChooseRandomStringFromArray(nightStrings); yield return(new WaitForSeconds(4)); //Let them read the night string. TownsPerson p = KillVillager(); ont.text = ont.text + "\n\nThe werewolf has killed the " + p.name + "."; yield return(new WaitForSeconds(4)); //Let them read who died. //Reset for new day. dayTime = 0; day = true; madeChoice = false; ClearTextElements(); ResetVisitedTownsfolk(); graveyard.SetActive(true); }
public void ChoiceClicked(int choice) { if (madeChoice || waitForNewHouse) //Prevent clicks mattering on result text. { return; } currentHouse.person.visited = true; ClearTextElements(); tpName.GetComponent <Text>().text = currentHouse.person.name; description.GetComponent <Text>().text = currentHouse.person.responses[choice]; if (choice == currentHouse.person.chooseWisely) { var deadPeople = from person in people where person.dead && !person.gaveBoon select person; if (currentHouse.person.name == "GraveRobber" && deadPeople.Count() > 0 && Random.Range(0, 1) == 0) { //Handle taking stuff from the dead person. TownsPerson p = deadPeople.ElementAt(Random.Range(0, deadPeople.Count())); playerStats.AddBuff(p.buff); p.gaveBoon = true; rewardText.GetComponent <Text>().text = "You received: " + p.reward + " (gross)"; //But also handle the grave robber. currentHouse.person.gaveBoon = true; } else { playerStats.AddBuff(currentHouse.person.buff); currentHouse.person.gaveBoon = true; rewardText.GetComponent <Text>().text = "You received: " + currentHouse.person.reward; } audioSource.PlayOneShot(upgradeSound); madeChoice = true; StartCoroutine(EndDay(choice)); } else { waitForNewHouse = true; } }