public void AddMessage(DialogueMessage text) { if (messages.Count == 0) messages.Add(new DialogueMessage("", 0f, 0)); messages.Add(text); }
public void showText(DialogueMessage inp) { if (message_count - start < MAX_MSG) { messages[Mathf.FloorToInt(message_count % MAX_MSG)] = inp; message_count++; } }
private void DisplayText(DialogueMessage inp) { if (inp.audio != null) { print("playing"); if (this.GetComponent<AudioSource>().clip != inp.audio || !this.GetComponent<AudioSource>().isPlaying) { this.GetComponent<AudioSource>().clip = inp.audio; this.GetComponent<AudioSource>().Play(); } } else if (inp.isPlayer) { print("playing"); if (this.GetComponent<AudioSource>().clip != p.voice || !this.GetComponent<AudioSource>().isPlaying) { this.GetComponent<AudioSource>().clip = p.voice; this.GetComponent<AudioSource>().Play(); } } else { print("did not play"); this.GetComponent<AudioSource>().Stop(); } if(inp.isPlayer) { ((Image)this.GetComponent<Transform>().FindChild("Portrait").GetComponent<Image>()).enabled = false; } else { ((Image)this.GetComponent<Transform>().FindChild("Portrait").GetComponent<Image>()).enabled = true; } if(inp.isConvo == false) { print("not a convo"); this.GetComponentInChildren<Text>().text = inp.message; ((Image)this.GetComponent<Transform>().FindChild("Portrait").GetComponent<Image>()).sprite = inp.picLoc; } else { print("is a convo"); p.isConvoMode = true; this.GetComponentInChildren<Text>().text = inp.message; ((Image)this.GetComponent<Transform>().FindChild("Portrait").GetComponent<Image>()).sprite = inp.picLoc; this.GetComponent<Transform>().FindChild("Option 1").gameObject.SetActive(true); this.GetComponent<Transform>().FindChild("Cursor 1").gameObject.SetActive(true); this.GetComponent<Transform>().FindChild("Option 2").gameObject.SetActive(true); p.setConvoMode(true, this.GetComponent<Transform>().FindChild("Cursor 1").gameObject, this.GetComponent<Transform>().FindChild("Cursor 2").gameObject); } }