// given a murderer, weapon and motive, creates a VerbalClue[] containing 6 relevant verbal clues public void CreateVerbalClues(string motive, MurderWeapon weapon, NonPlayerCharacter murderer) //UPDATED BY WEDUNNIT { murdererName = murderer.getNickname(); //UPDATED BY WEDUNNIT string weapon_name = weapon.getID(); VerbalClue disposing_of_weapon = new VerbalClue("Disposing of a Weapon", "I saw " + murdererName + " trying to " + "dispose of a " + weapon_name + ". Or was it " + getRandomNonMurderingNPCName(murdererName) + "? I can't remember."); //UPDATED BY WEDUNNIT VerbalClue old_friends = new VerbalClue("Old Friends", "The victim fell out with with " + getRandomNonMurderingNPCName(murdererName) + " and " + murdererName + " a long time ago " + getMotiveClause(motive)); //UPDATED BY WEDUNNIT VerbalClue old_enemies = new VerbalClue("Old Enemies", "Rumour is that the victim had an unpleasant past with " + murdererName + "."); //UPDATED BY WEDUNNIT VerbalClue last_seen_with = new VerbalClue("Last Seen With", "I saw the victim talking with " + getRandomNonMurderingNPCName(murdererName) + " and " + murdererName + " just a few minutes before their body was discovered."); //UPDATED BY WEDUNNIT VerbalClue altercation = new VerbalClue("An Altercation", "There once was an altercation between" + getRandomNonMurderingNPCName(murdererName) + " and " + murdererName + ", " + getMotiveClause(motive)); //UPDATED BY WEDUNNIT VerbalClue changed_story = new VerbalClue("Stories Have Changed", murdererName + " told me they last saw the victim before 8pm, but told " + getRandomNonMurderingNPCName(murdererName) + " that they didnt speak to the victim at all..."); //UPDATE BY WEDUNNIT verbal_clues = new VerbalClue[6] { old_friends, altercation, disposing_of_weapon, old_enemies, last_seen_with, changed_story }; }
public void QuestionCharacter(int reference) { //reference passes the question style reference i.e leftmost button=0, middle=1, rightmost=2 string choice; List <string> weaknesses; string response; choice = GetQuestioningChoice(reference); weaknesses = character.GetWeaknesses(); if ((weaknesses.Contains(choice)) && (character.getVerbalClue() != null)) { //If chosen style is a weakness to the character VerbalClue clue = character.getVerbalClue(); if (!NotebookManager.instance.logbook.GetLogbook().Contains(character.getVerbalClue())) { //If the logbook doesnt contain the clue already response = "Clue Added: " + clue.getDescription(); //Change the responce and add to the logbook NotebookManager.instance.logbook.AddVerbalClueToLogbook(clue); NotebookManager.instance.UpdateNotebook(); } else { response = "Clue Already Obtained"; //Otherwise state the clue is already in the logbook } } else { response = character.GetResponse(choice); //Otherwise just give the responce } clueSpeech.text = response; //Update the UI Text with the appropriate repsonce }
public void TestSetup() { prefab = new GameObject(); verbalClue = new VerbalClue(null, null); npc = new NonPlayerCharacter(null, null, null, prefab, weaknesses, null); isMurderer = npc.IsMurderer(); //set verbal clue to empty so all tests work npc.setVerbalClue(null); }
public void SetOwnerTest() { //Arrange var verbalClue = new VerbalClue(null, null); var owner = new NonPlayerCharacter(null, null, null, null, null, null); //Act verbalClue.SetOwner(owner); //Assert Assert.AreSame(verbalClue.GetOwner(), owner); }
public void TestSetup() { try { logbook = new Logbook(); verbalClue = new VerbalClue(null, null); logbook.AddVerbalClueToLogbook(verbalClue); } catch (Exception e) { Debug.Log(e); } }
public void GetVerbalClueTest() { //Arrange var npc = new NonPlayerCharacter(null, null, null, null, null, null); var verbalClue = new VerbalClue(null, null); Assert.IsNull(npc.getVerbalClue()); //Act npc.setVerbalClue(verbalClue); //Assert Assert.AreSame(verbalClue, npc.getVerbalClue()); }
public void AddVerbalClueToLogbookTest() { //Arrange var logbook = new Logbook(); var verbalClue = new VerbalClue(null, null); //Act //To add verbalClue to logbook logbook.AddVerbalClueToLogbook(verbalClue); //Assert //The logbook contains the the verbalClue Assert.IsTrue(logbook.GetLogbook().Contains(verbalClue)); }
public void GetLengthOfLogbookTest() { //Arrange var logbook = new Logbook(); var verbalClue = new VerbalClue(null, null); //Act //To add verbalClue to logbook logbook.AddVerbalClueToLogbook(verbalClue); //Assert //The logbook is has length one Assert.AreEqual(logbook.GetListLength(), 1); }
public void GetOwnerTest() { //Arrange var verbalClue = new VerbalClue(null, null); var owner = new NonPlayerCharacter(null, null, null, null, null, null); verbalClue.SetOwner(owner); //Act //Try to rename the GameObject var fetchedOwner = verbalClue.GetOwner(); //Assert //The object has a new name Assert.AreSame(fetchedOwner, owner); }
public void ResetLogbookTest() { //Arrange var logbook = new Logbook(); var verbalClue = new VerbalClue(null, null); //Act //To add verbalClue to logbook logbook.AddVerbalClueToLogbook(verbalClue); logbook.Reset(); //Assert //The logbook is empty Assert.IsEmpty(logbook.GetLogbook()); }
public void QuestionCharacter(int reference) { //reference passes the question style reference i.e leftmost button=0, middle=1, rightmost=2 string response; string choice; choice = GetQuestioningChoice(reference); if (character.CanBeQuestionned()) //ADDITION BY WEDUNNIT { List <string> weaknesses; weaknesses = character.GetWeaknesses(); if ((weaknesses.Contains(choice)) && (character.getVerbalClue() != null)) //If chosen style is a weakness to the character { VerbalClue clue = character.getVerbalClue(); if (!NotebookManager.instance.logbook.GetLogbook().Contains(character.getVerbalClue())) //If the logbook doesnt contain the clue already { response = "Clue Added: " + clue.getDescription(); //Change the responce and add to the logbook NotebookManager.instance.logbook.AddVerbalClueToLogbook(clue); GameMaster.instance.UnblockAllCharacters(); //ADDITION BY WEDUNNIT NotebookManager.instance.UpdateNotebook(); //__NEW_FOR_ASSESSMENT_4__(START) if (GameObject.Find("Multiplayer Manager Object") != null) { MultiplayerManager.instance.GetTurnManager().IncrementActionCounter(); // For turn switching in multiplayer. } //__NEW_FOR_ASSESSMENT_4__(END) } else { response = "Clue Already Obtained"; //Otherwise state the clue is already in the logbook } } else { response = character.GetResponse(choice); //Otherwise just give the responce } } else //If the character blocks questioning //ADDITION BY WEDUNNIT { response = character.GetResponse(choice + "ButBlocked"); //Gets relevent reply //ADDITION BY WEDUNNIT } clueSpeech.text = response; //Update the UI Text with the appropriate repsonce }
public void AddToSelectedClues(int reference) { //Adds the selected clue passed by reference in the inspector. Called when a toggle button value changes //If toggled on if (clueToggles [reference].isOn == true) { if (reference < inventory.GetInventory().Count) //If clue reference is an item { Item clue = inventory.GetInventory() [reference]; selectedCluesItem.Add(clue); //Add to selected Item clues } else { VerbalClue clue = logbook.GetLogbook() [reference - inventory.GetInventory().Count]; selectedCluesVerbal.Add(clue); //Otherwise must be a VerbalClue so add to selected VerbalClues } //If toggled off: } else { if (reference < inventory.GetInventory().Count) //If clue reference is an item { Item clue = inventory.GetInventory() [reference]; selectedCluesItem.Remove(clue); //Remove clue from selected item clues } else { VerbalClue clue = logbook.GetLogbook() [reference - inventory.GetInventory().Count]; selectedCluesVerbal.Remove(clue); //Otherwise must be a VerbalClue so remove from selected VerbalClues } } // if ((selectedCluesItem.Count + selectedCluesVerbal.Count) == requiredNumberOfClues) //If a total of (3) clues are selected make the submit button interactable { submitButton.interactable = true; } else { submitButton.interactable = false; //Otherwise make uninteratable } clueTitle.text = "Select " + requiredNumberOfClues + " Clues (" + (selectedCluesItem.Count + selectedCluesVerbal.Count) + "/" + requiredNumberOfClues + ")"; //Update title text }
public void ShowClueInfomation(int index) { //Check if the clue is in the given range. if (index < inventory.GetInventory().Count + logbook.GetLogbook().Count) { //Detect if it is an item if (index < inventory.GetInventory().Count) { Item clue = inventory.GetInventory() [index]; clueNameText.text = clue.getID(); clueDescriptionText.text = clue.getDescription(); clueImage.sprite = clue.GetSprite(); //Otherwise it must be a Verbal Clue } else { VerbalClue clue = logbook.GetLogbook() [index - inventory.GetInventory().Count]; clueNameText.text = clue.getID(); clueDescriptionText.text = clue.getDescription(); clueImage.sprite = questionMark; } } }
// Creates two lists of clues, one containing 3 verbal clues (two relevant, one useless) and one containing 6 item clues (2 relevent, 4 useless). public void BuildCluePools(string motive, NonPlayerCharacter murderer, MurderWeapon weapon) { // one of the relevant item clues is the murder weapon, there is only ever one MurderWeapon item present in the game. item_clue_pool.Add(weapon); relevant_item_clues.Add(weapon); int verbalClueWithMotive = Random.Range(0, 2); // UPDATED BY WEDUNNIT either 'old friends' or 'altercation' for the first verbal clue verbal_clue_pool.Add(verbal_clues [verbalClueWithMotive]); //ADDITION BY WEDUNNIT relevant_verbal_clues.Add(verbal_clues [verbalClueWithMotive]); //ADDITION BY WEDUNNIT int verbalClueWithWeapon = Random.Range(2, 6); // UPDATED BY WEDUNNIT any of the remaining verbal clues for the second verbal clue verbal_clue_pool.Add(verbal_clues [verbalClueWithWeapon]); relevant_verbal_clues.Add(verbal_clues [verbalClueWithWeapon]); switch (murdererName) //REFACTORED BY WEDUNNIT { case "Salty Seadog": item_clue_pool.Add(item_clues [4]); // shattered glass relevant_item_clues.Add(item_clues [4]); break; case "mimes": item_clue_pool.Add(item_clues [0]); // beret relevant_item_clues.Add(item_clues [0]); break; case "Money Bags": item_clue_pool.Add(item_clues [2]); // gloves relevant_item_clues.Add(item_clues [2]); break; case "Outlaw": item_clue_pool.Add(item_clues [8]); // tripwire relevant_item_clues.Add(item_clues [8]); break; case "Legionnaire": item_clue_pool.Add(item_clues [3]); // wine relevant_item_clues.Add(item_clues [3]); break; case "Dodgy Dealer": item_clue_pool.Add(item_clues [7]); // spellbook relevant_item_clues.Add(item_clues [7]); break; case "Superhero": item_clue_pool.Add(item_clues [19]); //Dumbbells //ADDITION BY WEDUNNIT relevant_item_clues.Add(item_clues [19]); //ADDITION BY WEDUNNIT break; case "Mad scientist": item_clue_pool.Add(item_clues [18]); // glasses //ADDITION BY WEDUNNIT relevant_item_clues.Add(item_clues [18]); //ADDITION BY WEDUNNIT break; case "Telechubbie": item_clue_pool.Add(item_clues [15]); //purse //ADDITION BY WEDUNNIT relevant_item_clues.Add(item_clues [15]); //ADDITION BY WEDUNNIT break; case "Reginald M IV": item_clue_pool.Add(item_clues [17]); //monocle //ADDITION BY WEDUNNIT relevant_item_clues.Add(item_clues [17]); //ADDITION BY WEDUNNIT break; default: throw new System.ArgumentException(murdererName + " does not have any clues associated with them."); } // add the 4 irrelevant verbal clues while (item_clue_pool.Count() < 6) { int index = Random.Range(0, item_clues.Count() - 1); if (item_clue_pool.Contains(item_clues [index]) == false) { item_clue_pool.Add(item_clues [index]); } } // add 'red herring' verbal clue int weapon_index = Random.Range(0, weapons.Count() - 1); string red_herring_weapon = weapons [weapon_index].getID(); while (red_herring_weapon == weapon.getID()) { weapon_index = Random.Range(0, weapons.Count() - 1); red_herring_weapon = weapons [weapon_index].getID(); } int npc_index = Random.Range(0, npcs.Count() - 1); string red_herring_character = npcs [npc_index].getCharacterID(); while (red_herring_character == murderer.getCharacterID()) { npc_index = Random.Range(0, npcs.Count() - 1); red_herring_character = npcs [npc_index].getCharacterID(); } // create and then choose one of two irrelevant verbal clues VerbalClue police_failure = new VerbalClue("Lack of Evidence", "The police think the victim was killed using a " + red_herring_weapon + ", but they can’t find evidence of one."); VerbalClue shifty_looking = new VerbalClue("Looking Shifty", "I think I saw " + red_herring_character + " acting suspiciously."); VerbalClue[] red_herring_verbal_clues = new VerbalClue[2] { police_failure, shifty_looking }; int herring_index = Random.Range(0, 1); verbal_clue_pool.Add(red_herring_verbal_clues [herring_index]); }
// Creates two lists of clues, one containing 3 verbal clues (two relevant, one useless) and one containing 6 item clues (2 relevent, 4 useless). public void BuildCluePools(string motive, NonPlayerCharacter murderer, MurderWeapon weapon) { // one of the relevant item clues is the murder weapon, there is only ever one MurderWeapon item present in the game. item_clue_pool.Add(weapon); relevant_item_clues.Add(weapon); int pick_motive_clue = Random.Range(0, 1); // 'old friends' or 'altercation' if (motive == "homewrecker") { relevant_item_clues.Add(item_clues [pick_motive_clue]); verbal_clue_pool.Add(verbal_clues [pick_motive_clue]); } else if (motive == "loanshark") { verbal_clue_pool.Add(verbal_clues [pick_motive_clue]); relevant_verbal_clues.Add(verbal_clues [pick_motive_clue]); } else if (motive == "promotion") { verbal_clue_pool.Add(verbal_clues [pick_motive_clue]); relevant_verbal_clues.Add(verbal_clues [pick_motive_clue]); } else if (motive == "unfriended") { verbal_clue_pool.Add(verbal_clues [pick_motive_clue]); relevant_verbal_clues.Add(verbal_clues [pick_motive_clue]); } else if (motive == "blackmail") { verbal_clue_pool.Add(verbal_clues [pick_motive_clue]); relevant_verbal_clues.Add(verbal_clues [pick_motive_clue]); } else if (motive == "avenge_friend") { verbal_clue_pool.Add(verbal_clues [pick_motive_clue]); relevant_verbal_clues.Add(verbal_clues [pick_motive_clue]); } else if (motive == "avenge_pet") { verbal_clue_pool.Add(verbal_clues [pick_motive_clue]); relevant_verbal_clues.Add(verbal_clues [pick_motive_clue]); } int pick_weapon_clue = Random.Range(2, 5); verbal_clue_pool.Add(verbal_clues [pick_weapon_clue]); relevant_verbal_clues.Add(verbal_clues [pick_weapon_clue]); if (murderer.getCharacterID() == "Captain Bluebottle") { item_clue_pool.Add(item_clues [4]); // shattered glass relevant_item_clues.Add(item_clues [4]); } else if (murderer.getCharacterID() == "The Mime Twins") { item_clue_pool.Add(item_clues [0]); // beret relevant_item_clues.Add(item_clues [0]); } else if (murderer.getCharacterID() == "Sir Worchester") { item_clue_pool.Add(item_clues [2]); // gloves relevant_item_clues.Add(item_clues [2]); } else if (murderer.getCharacterID() == "Jesse Ranger") { item_clue_pool.Add(item_clues [8]); // tripwire relevant_item_clues.Add(item_clues [8]); } else if (murderer.getCharacterID() == "Celcius Maximus") { item_clue_pool.Add(item_clues [3]); // wine relevant_item_clues.Add(item_clues [3]); } else if (murderer.getCharacterID() == "Randolf the Deep Purple") { item_clue_pool.Add(item_clues [7]); // spellbook relevant_item_clues.Add(item_clues [7]); } // add the 6 irrelevant physical clues - NEW FOR ASSESSMENT 3 while (item_clue_pool.Count() < 8) { int index = Random.Range(0, item_clues.Count() - 1); if (item_clue_pool.Contains(item_clues [index]) == false) { item_clue_pool.Add(item_clues [index]); } } // add 'red herring' verbal clue int weapon_index = Random.Range(0, weapons.Count() - 1); string red_herring_weapon = weapons [weapon_index].getID(); while (red_herring_weapon == weapon.getID()) { weapon_index = Random.Range(0, weapons.Count() - 1); red_herring_weapon = weapons [weapon_index].getID(); } int npc_index = Random.Range(0, npcs.Count() - 1); string red_herring_character = npcs [npc_index].getCharacterID(); while (red_herring_character == murderer.getCharacterID()) { npc_index = Random.Range(0, npcs.Count() - 1); red_herring_character = npcs [npc_index].getCharacterID(); } // create and then choose one of two irrelevant verbal clues VerbalClue police_failure = new VerbalClue("Lack of Evidence", "The police think the victim was killed " + "using a " + red_herring_weapon + ", but they can’t find evidence of one."); VerbalClue shifty_looking = new VerbalClue("Looking Shifty", "I think I saw " + red_herring_character + " acting suspiciously."); VerbalClue[] red_herring_verbal_clues = new VerbalClue[2] { police_failure, shifty_looking }; int herring_index = Random.Range(0, 1); verbal_clue_pool.Add(red_herring_verbal_clues [herring_index]); }
// given a murderer, weapon and motive, creates a VerbalClue[] containing 6 relevant verbal clues public void CreateVerbalClues(string motive, MurderWeapon weapon, NonPlayerCharacter murderer) { string murderer_name = murderer.getNickname(); string weapon_name = weapon.getID(); VerbalClue disposing_of_weapon = new VerbalClue("Disposing of a Weapon", "I saw " + murderer_name + " trying to " + "dispose of a " + weapon_name + "."); string old_friends_description = "The victim and " + murderer_name + " fell out "; string motive_clause = "."; if (motive == "homewrecker") { string partner_gender; int binary = Random.Range(0, 1); if (binary == 0) { partner_gender = "wife"; } else { partner_gender = "husband"; } motive_clause = "because the victim slept with their " + partner_gender + "."; } if (motive == "loanshark") { motive_clause = "because " + murderer_name + " was in debt to the victim."; } if (motive == "promotion") { motive_clause = "because they were in competition professionally."; } if (motive == "unfriended") { motive_clause = "because the victim unfriended " + murderer_name + " on Facebook."; } if (motive == "blackmail") { motive_clause = "because the victim knew " + murderer_name + "'s darkest secret."; } if (motive == "avenge_friend") { old_friends_description = ""; motive_clause = murderer_name + " holds the victim responsible for a friend's death."; } if (motive == "avenge_pet") { string species; int rand = Random.Range(0, 4); if (rand == 0) { species = "parrot"; } else if (rand == 1) { species = "chihuahua"; } else if (rand == 2) { species = "iguana"; } else if (rand == 3) { species = "goldfish"; } else { species = "rattlesnake"; } string cause_of_death; rand = Random.Range(0, 4); if (rand == 0) { cause_of_death = "starvation"; } else if (rand == 1) { cause_of_death = "loneliness"; } else if (rand == 2) { cause_of_death = "a broken heart"; } else if (rand == 3) { cause_of_death = "boredom"; } else { cause_of_death = "electrocution"; } old_friends_description = ""; motive_clause = "The victim was looking after " + murderer_name + "'s " + species + " when it " + "died of " + cause_of_death + "."; } old_friends_description += motive_clause; VerbalClue old_friends = new VerbalClue("Old Friends", old_friends_description); VerbalClue old_enemies = new VerbalClue("Old Enemies", "Rumour is that the victim had an unpleasant " + "history with " + murderer_name + "."); VerbalClue last_seen_with = new VerbalClue("Last Seen With", "I saw the victim alone with " + murderer_name + " just a few " + "minutes before their body was discovered."); string altercation_description = murderer_name + "and the victim had an altercation about "; motive_clause = "."; if (motive == "homewrecker") { string partner_gender; int binary = Random.Range(0, 1); if (binary == 0) { partner_gender = "wife"; } else { partner_gender = "husband"; } motive_clause = "the victim sleeping with their " + partner_gender + "."; } if (motive == "loanshark") { motive_clause = murderer_name + " being in debt to the victim."; } if (motive == "promotion") { motive_clause = "them being in competition professionally."; } if (motive == "unfriended") { motive_clause = "the victim unfriending them on Facebook."; } if (motive == "blackmail") { motive_clause = "the victim having found out their darkest secret."; } if (motive == "avenge_friend") { motive_clause = "the death of a mutual friend."; } if (motive == "avenge_pet") { motive_clause = murderer_name + "'s pet having died."; } VerbalClue altercation = new VerbalClue("An Altercation", altercation_description); int random = Random.Range(0, npcs.Count()); string character_name = npcs [random].getCharacterID(); VerbalClue changed_story = new VerbalClue("Stories Have Changed", murderer_name + " told me they last saw the " + "victim before 8pm, but told " + character_name + " they spoke to the victim after 9pm."); verbal_clues = new VerbalClue[6] { old_friends, altercation, disposing_of_weapon, old_enemies, last_seen_with, changed_story }; }
public void AddVerbalClueToLogbook(VerbalClue clue) { logbook.Add(clue); }
public void setVerbalClue(VerbalClue clue) { verbalClue = clue; }
public void TestSetup() { verbalClue = new VerbalClue(null, null); owner = new NonPlayerCharacter(null, null, null, null, null, null); verbalClue.SetOwner(owner); }