void OnGUI() { GUI.skin = skin; if (isTalking) { //convoStart() int i = 0; if (!boxTexture) { Debug.LogError("Dialogue Texture missing"); return; } GUI.DrawTexture(new Rect(xPos - 40, yPos - 35, boxWidth + 70, boxHeight), boxTexture, ScaleMode.StretchToFill, true, 10.0F); GUI.Label(new Rect(xPos, yPos, boxWidth, boxHeight), currentNode.GetDialogue()); GUI.Label(new Rect(xPos, yPos - 25, Screen.width - 10, 200), currentNode.GetActorName() + ":"); int x = 370; foreach (DialogueEdge edge in currentNode.GetNeighbors()) { int y = (int)yPos + (boxHeight + 5); if (edge.GetTo().GetCondition() != null) { if (!m.CheckCondition(edge.GetTo().GetCondition())) { continue; } } if (GUI.Button(new Rect(x, y, 330, 120), edge.GetTo().GetDialogue())) { //if there are replies if (edge.GetTo().GetNeighbors().Count >= 1) { //broken down /* * List<DialogueEdge> lol = edge.GetTo().GetNeighbors(); * DialogueEdge lolz = (DialogueEdge)lol[0]; * currentNode = (DialogueNode)lolz.GetTo(); */ //simplified currentNode = edge.GetTo().GetNeighbors()[0].GetTo(); } else { //Convo is over Debug.Log("Conversation Over"); isTalking = false; NPCstate = edge.GetTo().GetNextState(); currentNode = GetStartNode(NPCstate); //convoEnd() } } x += 340; i++; } } }