public void clues() // Create a list of clues and check that the clues are assigned to a value { //In the createclues.make_clues_crime_1() function commment out anything to do with sprites clue clue1 = new clue(); clue clue2 = new clue(); clue clue3 = new clue(); clue clue4 = new clue(); clue clue5 = new clue(); clue clue6 = new clue(); clue clue7 = new clue(); clue clue8 = new clue(); clue motive_clue = new clue(); //Motive clue added to test createClue createclues = new createClue(); createclues.clue_1 = clue1; createclues.clue_2 = clue2; createclues.clue_3 = clue3; createclues.clue_4 = clue4; createclues.clue_5 = clue5; createclues.clue_5 = clue5; createclues.clue_6 = clue6; createclues.verbal_clue_7 = clue7; createclues.verbal_clue_8 = clue8; createclues.motiveClue = motive_clue; createclues.make_clues_crime_1(); Assert.AreNotEqual(clue1.getName(), null); // Test fails if a clue is empty }
public void clues() // Create a list of clues and check that the clues are assigned to a value { clue clue1 = new clue(); clue clue2 = new clue(); clue clue3 = new clue(); clue clue4 = new clue(); clue clue5 = new clue(); clue clue6 = new clue(); clue clue7 = new clue(); clue clue8 = new clue(); createClue createclues = new createClue(); createclues.clue_1 = clue1; createclues.clue_2 = clue2; createclues.clue_3 = clue3; createclues.clue_4 = clue4; createclues.clue_5 = clue5; createclues.clue_5 = clue5; createclues.clue_6 = clue6; createclues.verbal_clue_7 = clue7; createclues.verbal_clue_8 = clue8; createclues.make_clues_crime_1(); Assert.AreNotEqual(clue1.getName(), null); // Test fails if a clue is empty }
// initlaise all of the game objects to have clue attributes public void setClues() { // get the components for each of the clues clue_1 = clue1.GetComponent <clue>(); clue_1.cluename = "Clue1"; clue1.GetComponent <SpriteRenderer>().sprite = clue_1.look; clue_2 = clue2.GetComponent <clue>(); clue_2.cluename = "Clue2"; clue2.GetComponent <SpriteRenderer>().sprite = clue_2.look; clue_3 = clue3.GetComponent <clue>(); clue_3.cluename = "Clue3"; clue3.GetComponent <SpriteRenderer>().sprite = clue_3.look; clue_4 = clue4.GetComponent <clue>(); clue_4.cluename = "Clue4"; clue4.GetComponent <SpriteRenderer>().sprite = clue_4.look; clue_5 = clue5.GetComponent <clue>(); clue_5.cluename = "Clue5"; clue5.GetComponent <SpriteRenderer>().sprite = clue_5.look; clue_6 = clue6.GetComponent <clue>(); clue_6.cluename = "Clue6"; clue6.GetComponent <SpriteRenderer>().sprite = clue_6.look; verbal_clue_7 = clue7_verbal.GetComponent <clue>(); verbal_clue_7.is_verbal = true; verbal_clue_8 = clue8_verbal.GetComponent <clue>(); verbal_clue_8.is_verbal = true; }
public void clue_found_by_both_players() { // create a clue that can be found by the players clue clue = new clue(); // set the clue so that it is found by both of the players clue.is_found1 = true; clue.is_found2 = true; //assert that the clue has been found by both of the players Assert.IsTrue(clue.found_by_both() == true); }
public void createButton(GameObject go) { if (go.GetComponentInChildren <SpriteRenderer>() == null) { return; } currentClue = go; GameObject newButton = Instantiate(baseButton, clueListTransform); newButton.SetActive(true); newButton.GetComponent <Image>().sprite = go.GetComponentInChildren <SpriteRenderer>().sprite; clue clue = go.GetComponentInChildren <clue>(); newButton.name = clue.clueName + "Clue"; newButton.GetComponent <clueButton>().clueName = clue.clueName; newButton.GetComponent <clueButton>().flavorText = clue.flavorText; newButton.GetComponentInChildren <Text>().text = clue.clueName; newButton.GetComponent <clueButton>().clueLocation = clue.originLocation; //newButton.GetComponentInChildren<Text>().text = }
void GetAllData() { XmlDocument xmlDoc = new XmlDocument(); // xmlDoc is the new xml document. xmlDoc.LoadXml(theXMLFile.text); // load the file. XmlNodeList puzzlesList = xmlDoc.GetElementsByTagName("crossword_puzzle"); // array of the level nodes. Output += "Total Puzzles inside the file is[" + puzzlesList.Count + "]"; Output += "\n******************************************"; foreach (XmlNode puzzleInfo in puzzlesList) { aPuzzle _tempPuzzle = new aPuzzle(); _tempPuzzle.number = puzzleInfo.Attributes["number"].Value; _tempPuzzle.difficulty = puzzleInfo.Attributes["difficulty"].Value; _tempPuzzle.tag = puzzleInfo.Attributes["tag"].Value; //Debug.Log (puzzleInfo.Attributes["number"].Value); //Debug.Log (puzzleInfo.Attributes["difficulty"].Value); //Debug.Log (puzzleInfo.Attributes["tag"].Value); Output += "\nPuzzle Number[" + _tempPuzzle.number + "]"; Output += "\nPuzzle Difficulty[" + _tempPuzzle.difficulty + "]"; Output += "\nPuzzle Tag[" + _tempPuzzle.tag + "]"; XmlNodeList puzzlecontent = puzzleInfo.ChildNodes; foreach (XmlNode puzzleNode in puzzlecontent) { if (puzzleNode.Name == "title") { _tempPuzzle.title = puzzleNode.InnerText; Output += "\nPuzzle Title[" + _tempPuzzle.title + "]"; //Debug.Log (puzzleNode.InnerText); } if (puzzleNode.Name == "grid") { _tempPuzzle.puzzleSize = puzzleNode.Attributes["size"].Value; _tempPuzzle.puzzleCutout = puzzleNode.Attributes["cutout"].Value; _tempPuzzle.puzzleSolid = puzzleNode.Attributes["solid"].Value; _tempPuzzle.puzzleData = puzzleNode.InnerText; //Debug.Log (puzzleNode.Attributes["size"].Value); //Debug.Log (puzzleNode.Attributes["cutout"].Value); //Debug.Log (puzzleNode.Attributes["solid"].Value); //Debug.Log (puzzleNode.InnerText); Output += "\nPuzzle Size[" + _tempPuzzle.puzzleSize + "]"; Output += "\nPuzzle Cutout[" + _tempPuzzle.puzzleCutout + "]"; Output += "\nPuzzle Solid[" + _tempPuzzle.puzzleSolid + "]"; Output += "\nPuzzle Data[" + _tempPuzzle.puzzleData + "]"; Output += "\n******************************************"; } //Output += "\n******************************************"; //Output += "\n***********[ACROSS CLUES]*****************"; //Output += "\n******************************************"; if (puzzleNode.Name == "across") { XmlNodeList clues = puzzleNode.ChildNodes; foreach (XmlNode clue in clues) { clue _tempClue = new clue(); _tempClue.type = "across"; _tempClue.number = clue.Attributes["number"].Value; //Debug.Log ("The across Clue number [" + clue.Attributes["number"].Value + "]"); XmlNodeList clueTypes = clue.ChildNodes; foreach (XmlNode clueType in clueTypes) { if (clueType.Name == "primary") { _tempClue.primary = clueType.InnerText; //Debug.Log ("Primary Clue is " + clueType.InnerText); } if (clueType.Name == "alternate") { _tempClue.alternate = clueType.InnerText; //Debug.Log ("Alternate Clue is " + clueType.InnerText); } } _tempPuzzle.acrossClues.Add(_tempClue); //Output += "\n[" + _tempClue.number + "] ---- Primary[" + _tempClue.primary + "] ---- Alt[" + _tempClue.alternate + "]"; } } //Output += "\n******************************************"; //Output += "\n***********[DOWN CLUES]*******************"; //Output += "\n******************************************"; if (puzzleNode.Name == "down") { XmlNodeList clues = puzzleNode.ChildNodes; foreach (XmlNode clue in clues) { clue _tempClue = new clue(); _tempClue.type = "down"; _tempClue.number = clue.Attributes["number"].Value; //Debug.Log ("The across Clue number [" + clue.Attributes["number"].Value + "]"); XmlNodeList clueTypes = clue.ChildNodes; foreach (XmlNode clueType in clueTypes) { if (clueType.Name == "primary") { _tempClue.primary = clueType.InnerText; //Debug.Log ("Primary Clue is " + clueType.InnerText); } if (clueType.Name == "alternate") { _tempClue.alternate = clueType.InnerText; //Debug.Log ("Alternate Clue is " + clueType.InnerText); } } _tempPuzzle.downClues.Add(_tempClue); //Output += "\n[" + _tempClue.number + "] ---- Primary[" + _tempClue.primary + "] ---- Alt[" + _tempClue.alternate + "]"; } } } puzzles.Add(_tempPuzzle); } Debug.Log(puzzles.Count); }
public void BreakdownXML() { //xmlFile = (TextAsset)Resources.Load("Sampler", typeof(TextAsset)); //testFile XmlDocument xmlDoc = new XmlDocument(); // xmlDoc is the new xml document. xmlDoc.LoadXml(xmlFile.text); // load the file. XmlNodeList puzzlesList = xmlDoc.GetElementsByTagName("crossword_puzzle"); // array of the level nodes. //Debug.Log (puzzlesList.Count); // the total amount of puzzles inside the file foreach (XmlNode puzzleInfo in puzzlesList) { aPuzzle _tempPuzzle = new aPuzzle(); _tempPuzzle.number = puzzleInfo.Attributes["number"].Value; _tempPuzzle.difficulty = puzzleInfo.Attributes["difficulty"].Value; _tempPuzzle.tag = puzzleInfo.Attributes["tag"].Value; //Debug.Log (puzzleInfo.Attributes["number"].Value); //Debug.Log (puzzleInfo.Attributes["difficulty"].Value); //Debug.Log (puzzleInfo.Attributes["tag"].Value); XmlNodeList puzzlecontent = puzzleInfo.ChildNodes; foreach (XmlNode puzzleNode in puzzlecontent) { if (puzzleNode.Name == "title") { _tempPuzzle.title = puzzleNode.InnerText; //Debug.Log (puzzleNode.InnerText); } if (puzzleNode.Name == "grid") { _tempPuzzle.puzzleSize = puzzleNode.Attributes["size"].Value; _tempPuzzle.puzzleCutout = puzzleNode.Attributes["cutout"].Value; _tempPuzzle.puzzleSolid = puzzleNode.Attributes["solid"].Value; _tempPuzzle.puzzleData = puzzleNode.InnerText; //Debug.Log (puzzleNode.Attributes["size"].Value); //Debug.Log (puzzleNode.Attributes["cutout"].Value); //Debug.Log (puzzleNode.Attributes["solid"].Value); //Debug.Log (puzzleNode.InnerText); } if (puzzleNode.Name == "across") { XmlNodeList clues = puzzleNode.ChildNodes; foreach (XmlNode clue in clues) { clue _tempClue = new clue(); _tempClue.type = "across"; _tempClue.number = clue.Attributes["number"].Value; //Debug.Log ("The across Clue number [" + clue.Attributes["number"].Value + "]"); XmlNodeList clueTypes = clue.ChildNodes; foreach (XmlNode clueType in clueTypes) { if (clueType.Name == "primary") { _tempClue.primary = clueType.InnerText; //Debug.Log ("Primary Clue is " + clueType.InnerText); } if (clueType.Name == "alternate") { _tempClue.alternate = clueType.InnerText; //Debug.Log ("Alternate Clue is " + clueType.InnerText); } } _tempPuzzle.acrossClues.Add(_tempClue); } } if (puzzleNode.Name == "down") { XmlNodeList clues = puzzleNode.ChildNodes; foreach (XmlNode clue in clues) { clue _tempClue = new clue(); _tempClue.type = "down"; _tempClue.number = clue.Attributes["number"].Value; //Debug.Log ("The across Clue number [" + clue.Attributes["number"].Value + "]"); XmlNodeList clueTypes = clue.ChildNodes; foreach (XmlNode clueType in clueTypes) { if (clueType.Name == "primary") { _tempClue.primary = clueType.InnerText; //Debug.Log ("Primary Clue is " + clueType.InnerText); } if (clueType.Name == "alternate") { _tempClue.alternate = clueType.InnerText; //Debug.Log ("Alternate Clue is " + clueType.InnerText); } } _tempPuzzle.downClues.Add(_tempClue); } } } puzzles.Add(_tempPuzzle); } //Debug.Log (puzzles.Count); //just for testing //GridManager.Instance.currentPuzzle = puzzles[0]; //GridManager.Instance.BuildTheGrid(); }
public void add_clue(clue clue) { if (GameObject.FindWithTag("gamemanager").GetComponent<gameManager>().get_player_turn() == 1) { if (clue.is_verbal == false) { if (clue_count1 == 0) { GameObject.FindWithTag("logpic1").GetComponent<SpriteRenderer>().sprite = clue.look; logbooktext1 = clue.name; logbooktext1 += "\n" + clue.getInfo(); increase_count(); } else if (clue_count1 == 1) { GameObject.FindWithTag("logpic2").GetComponent<SpriteRenderer>().sprite = clue.look; logbooktext2 = clue.name; logbooktext2 += "\n" + clue.getInfo(); increase_count(); } else if (clue_count1 == 2) { GameObject.FindWithTag("logpic3").GetComponent<SpriteRenderer>().sprite = clue.look; logbooktext3 = clue.name; logbooktext3 += "\n" + clue.getInfo(); increase_count(); } else if (clue_count1 == 3) { GameObject.FindWithTag("logpic4").GetComponent<SpriteRenderer>().sprite = clue.look; logbooktext4 = clue.name; logbooktext4 += "\n" + clue.getInfo(); increase_count(); } else if (clue_count1 == 4) { GameObject.FindWithTag("logpic5").GetComponent<SpriteRenderer>().sprite = clue.look; logbooktext5 = clue.name; logbooktext5 += "\n" + clue.getInfo(); increase_count(); } else if (clue_count1 == 5) { GameObject.FindWithTag("logpic6").GetComponent<SpriteRenderer>().sprite = clue.look; logbooktext6 = clue.name; logbooktext6 += "\n" + clue.getInfo(); increase_count(); } else if (clue_count1 == 6) { GameObject.FindWithTag("logpic7").GetComponent<SpriteRenderer>().sprite = clue.look; logbooktext7 = clue.name; logbooktext7 += "\n" + clue.getInfo(); increase_count(); } else { GameObject.FindWithTag("logpic8").GetComponent<SpriteRenderer>().sprite = clue.look; logbooktext8 = clue.name; logbooktext8 += "\n" + clue.getInfo(); increase_count(); } } else { if (clue_count1 == 0) { GameObject.FindWithTag("logpic1").GetComponent<SpriteRenderer>().sprite = clue.npc_verbal.headshot; logbooktext1 = clue.name; increase_count(); } else if (clue_count1 == 1) { GameObject.FindWithTag("logpic2").GetComponent<SpriteRenderer>().sprite = clue.npc_verbal.headshot; logbooktext2 = clue.name; increase_count(); } else if (clue_count1 == 2) { GameObject.FindWithTag("logpic3").GetComponent<SpriteRenderer>().sprite = clue.npc_verbal.headshot; logbooktext3 = clue.name; increase_count(); } else if (clue_count1 == 3) { GameObject.FindWithTag("logpic4").GetComponent<SpriteRenderer>().sprite = clue.npc_verbal.headshot; logbooktext4 = clue.name; increase_count(); } else if (clue_count1 == 4) { GameObject.FindWithTag("logpic5").GetComponent<SpriteRenderer>().sprite = clue.npc_verbal.headshot; logbooktext5 = clue.name; increase_count(); } else if (clue_count1 == 5) { GameObject.FindWithTag("logpic6").GetComponent<SpriteRenderer>().sprite = clue.npc_verbal.headshot; logbooktext6 = clue.name; increase_count(); } else if (clue_count1 == 6) { GameObject.FindWithTag("logpic7").GetComponent<SpriteRenderer>().sprite = clue.npc_verbal.headshot; logbooktext7 = clue.name; increase_count(); } else { GameObject.FindWithTag("logpic8").GetComponent<SpriteRenderer>().sprite = clue.npc_verbal.headshot; logbooktext8 = clue.name; increase_count(); } } } else // else if its player 2 who clicks on the clue { if (clue.is_verbal == false) { if (clue_count2 == 0) { GameObject.FindWithTag("logpic1_2").GetComponent<SpriteRenderer>().sprite = clue.look; logbooktext1_2 = clue.name; logbooktext1_2 += "\n" + clue.getInfo(); increase_count2(); } else if (clue_count2 == 1) { GameObject.FindWithTag("logpic2_2").GetComponent<SpriteRenderer>().sprite = clue.look; logbooktext2_2 = clue.name; logbooktext2_2 += "\n" + clue.getInfo(); increase_count2(); } else if (clue_count2 == 2) { GameObject.FindWithTag("logpic3_2").GetComponent<SpriteRenderer>().sprite = clue.look; logbooktext3_2 = clue.name; logbooktext3_2 += "\n" + clue.getInfo(); increase_count2(); } else if (clue_count2 == 3) { GameObject.FindWithTag("logpic4_2").GetComponent<SpriteRenderer>().sprite = clue.look; logbooktext4_2 = clue.name; logbooktext4_2 += "\n" + clue.getInfo(); increase_count2(); } else if (clue_count2 == 4) { GameObject.FindWithTag("logpic5_2").GetComponent<SpriteRenderer>().sprite = clue.look; logbooktext5_2 = clue.name; logbooktext5_2 += "\n" + clue.getInfo(); increase_count2(); } else if (clue_count2 == 5) { GameObject.FindWithTag("logpic6_2").GetComponent<SpriteRenderer>().sprite = clue.look; logbooktext6_2 = clue.name; logbooktext6_2 += "\n" + clue.getInfo(); increase_count2(); } else if (clue_count2 == 6) { GameObject.FindWithTag("logpic7_2").GetComponent<SpriteRenderer>().sprite = clue.look; logbooktext7_2 = clue.name; logbooktext7_2 += "\n" + clue.getInfo(); increase_count2(); } else { GameObject.FindWithTag("logpic8_2").GetComponent<SpriteRenderer>().sprite = clue.look; logbooktext8_2 = clue.name; logbooktext8_2 += "\n" + clue.getInfo(); increase_count2(); } } else { if (clue_count2 == 0) { GameObject.FindWithTag("logpic1_2").GetComponent<SpriteRenderer>().sprite = clue.npc_verbal.headshot; logbooktext1_2 = clue.name; increase_count2(); } else if (clue_count2 == 1) { GameObject.FindWithTag("logpic2_2").GetComponent<SpriteRenderer>().sprite = clue.npc_verbal.headshot; logbooktext2_2 = clue.name; increase_count2(); } else if (clue_count2 == 2) { GameObject.FindWithTag("logpic3_2").GetComponent<SpriteRenderer>().sprite = clue.npc_verbal.headshot; logbooktext3_2 = clue.name; increase_count2(); } else if (clue_count2 == 3) { GameObject.FindWithTag("logpic4_2").GetComponent<SpriteRenderer>().sprite = clue.npc_verbal.headshot; logbooktext4_2 = clue.name; increase_count2(); } else if (clue_count2 == 4) { GameObject.FindWithTag("logpic5_2").GetComponent<SpriteRenderer>().sprite = clue.npc_verbal.headshot; logbooktext5_2 = clue.name; increase_count2(); } else if (clue_count2 == 5) { GameObject.FindWithTag("logpic6_2").GetComponent<SpriteRenderer>().sprite = clue.npc_verbal.headshot; logbooktext6_2 = clue.name; increase_count2(); } else if (clue_count2 == 6) { GameObject.FindWithTag("logpic7_2").GetComponent<SpriteRenderer>().sprite = clue.npc_verbal.headshot; logbooktext7_2 = clue.name; increase_count2(); } else { GameObject.FindWithTag("logpic8_2").GetComponent<SpriteRenderer>().sprite = clue.npc_verbal.headshot; logbooktext8_2 = clue.name; increase_count2(); } } } }
public void add_clue(clue clue) { if (clue.is_verbal == false) { if (clue_count == 0) { GameObject.FindWithTag("logpic1").GetComponent <SpriteRenderer>().sprite = clue.look; logbooktext1 = clue.name; logbooktext1 += "\n" + clue.getInfo(); increase_count(); } else if (clue_count == 1) { GameObject.FindWithTag("logpic2").GetComponent <SpriteRenderer>().sprite = clue.look; logbooktext2 = clue.name; logbooktext2 += "\n" + clue.getInfo(); increase_count(); } else if (clue_count == 2) { GameObject.FindWithTag("logpic3").GetComponent <SpriteRenderer>().sprite = clue.look; logbooktext3 = clue.name; logbooktext3 += "\n" + clue.getInfo(); increase_count(); } else if (clue_count == 3) { GameObject.FindWithTag("logpic4").GetComponent <SpriteRenderer>().sprite = clue.look; logbooktext4 = clue.name; logbooktext4 += "\n" + clue.getInfo(); increase_count(); } else if (clue_count == 4) { GameObject.FindWithTag("logpic5").GetComponent <SpriteRenderer>().sprite = clue.look; logbooktext5 = clue.name; logbooktext5 += "\n" + clue.getInfo(); increase_count(); } else if (clue_count == 5) { GameObject.FindWithTag("logpic6").GetComponent <SpriteRenderer>().sprite = clue.look; logbooktext6 = clue.name; logbooktext6 += "\n" + clue.getInfo(); increase_count(); } else if (clue_count == 6) { GameObject.FindWithTag("logpic7").GetComponent <SpriteRenderer>().sprite = clue.look; logbooktext7 = clue.name; logbooktext7 += "\n" + clue.getInfo(); increase_count(); } else { GameObject.FindWithTag("logpic8").GetComponent <SpriteRenderer>().sprite = clue.look; logbooktext8 = clue.name; logbooktext8 += "\n" + clue.getInfo(); increase_count(); } } else { if (clue_count == 0) { GameObject.FindWithTag("logpic1").GetComponent <SpriteRenderer>().sprite = clue.npc_verbal.headshot; logbooktext1 = clue.name; increase_count(); } else if (clue_count == 1) { GameObject.FindWithTag("logpic2").GetComponent <SpriteRenderer>().sprite = clue.npc_verbal.headshot; logbooktext2 = clue.name; increase_count(); } else if (clue_count == 2) { GameObject.FindWithTag("logpic3").GetComponent <SpriteRenderer>().sprite = clue.npc_verbal.headshot; logbooktext3 = clue.name; increase_count(); } else if (clue_count == 3) { GameObject.FindWithTag("logpic4").GetComponent <SpriteRenderer>().sprite = clue.npc_verbal.headshot; logbooktext4 = clue.name; increase_count(); } else if (clue_count == 4) { GameObject.FindWithTag("logpic5").GetComponent <SpriteRenderer>().sprite = clue.npc_verbal.headshot; logbooktext5 = clue.name; increase_count(); } else if (clue_count == 5) { GameObject.FindWithTag("logpic6").GetComponent <SpriteRenderer>().sprite = clue.npc_verbal.headshot; logbooktext6 = clue.name; increase_count(); } else if (clue_count == 6) { GameObject.FindWithTag("logpic7").GetComponent <SpriteRenderer>().sprite = clue.npc_verbal.headshot; logbooktext7 = clue.name; increase_count(); } else { GameObject.FindWithTag("logpic8").GetComponent <SpriteRenderer>().sprite = clue.npc_verbal.headshot; logbooktext8 = clue.name; increase_count(); } } }