public Dialogue GetDialogue(Item obj) { string name = obj.GetName(); Ship ship = FindObjectOfType <Ship>(); int count = ship.GetRequiredItems().Count - (invCount + ship.GetLastFinished()); string[] text; Dialogue.Names[] names; if (count == 0) { text = new string[3]; text[0] = "You found " + name + "."; text[1] = "Now we can repair our ship."; text[2] = "Let us return to it!"; names = new Dialogue.Names[3]; names[0] = Dialogue.Names.Inventory; names[1] = Dialogue.Names.Inventory; } else { names = new Dialogue.Names[2]; names[0] = Dialogue.Names.Inventory; names[1] = Dialogue.Names.Inventory; text = new string[2]; text[0] = "You found " + name + "."; text[1] = "You only need " + count + " more Supplies."; } Dialogue invDialogue = new Dialogue(names, text); return(invDialogue); }
public void DisplayNextSentence() { sentencePlaying = true; if (sentences.Count == 0) { if (dialogueQueue.Count > 0) { SetCurrentDialogue(); return; } else { EndDialogue(); return; } } string sentence = sentences.Dequeue(); Dialogue.Names name = names.Dequeue(); if (name == Dialogue.Names.Pilot) { dialogBoxAnimator[0].SetBool("IsOpen", true); dialogBoxAnimator[1].SetBool("IsOpen", false); nameItem[0].text = name.ToString(); descriptionText[0].text = sentence; if (previusName != null && previusName != name) { bonusLength = 2; } } else { dialogBoxAnimator[0].SetBool("IsOpen", false); dialogBoxAnimator[1].SetBool("IsOpen", true); nameItem[1].text = name.ToString(); descriptionText[1].text = sentence; if (previusName != null && previusName != name) { bonusLength = 2; } } playLength = (((1f / 24f) * sentence.Length) * 1.75f) + bonusLength; bonusLength = 0; sentencePlaying = false; previusName = name; }