private Dialogue GetMessagesFromFile(StreamReader file) { Dialogue dialogue = new Dialogue(); char[] delim = { ' ', ',' }; while (true) { string line = file.ReadLine(); string [] values = line.Split(delim, 6, StringSplitOptions.RemoveEmptyEntries); if (values[0].Contains("<<<")) // end trigger { break; } // read the message float duration = float.Parse(values[0]); SpeakerState state = EnumUtil.FromString <SpeakerState>(values[1]); string speaker = values[2]; SpeakerLocation location = EnumUtil.FromString <SpeakerLocation>(values[3]); // ignore the literal "---" string message = values[5]; dialogue.AddMessage(duration, state, speaker, location, message); } return(dialogue); }
public Sprite GetSprite(SpeakerState state) { if (mSprites.ContainsKey(state)) return mSprites[state]; else return mSprites[SpeakerState.Normal]; }
public Sprite GetSprite(SpeakerState state) { if (mSprites.ContainsKey(state)) { return(mSprites[state]); } else { return(mSprites[SpeakerState.Normal]); } }
// when, how, who, where, what // ex. for <5> seconds, <Nervous> <King> (<Left> side), says <"Hello world!">, // for <3.2> seconds, <Normal> <Peasant> (<Right> side), says <"....blargh."> public void AddMessage(float duration, SpeakerState state, string speaker, SpeakerLocation location, string text) { Message message = new Message (); message.Duration = duration; message.Who = speaker; message.Text = text; message.Location = location; message.State = state; mMessages.Enqueue (message); }
// when, how, who, where, what // ex. for <5> seconds, <Nervous> <King> (<Left> side), says <"Hello world!">, // for <3.2> seconds, <Normal> <Peasant> (<Right> side), says <"....blargh."> public void AddMessage(float duration, SpeakerState state, string speaker, SpeakerLocation location, string text) { Message message = new Message(); message.Duration = duration; message.Who = speaker; message.Text = text; message.Location = location; message.State = state; mMessages.Enqueue(message); }
public void Activate(SpeakerState state) { mRenderer.sprite = GetSprite(state); mRenderer.enabled = true; }
public void Activate(SpeakerState state) { mRenderer.sprite = GetSprite(state); mRenderer.enabled = true; }