Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class DialogController
- {
- private int _index = 0;
- public void SetDialog(Dialog dialog, string[] text, bool isHaveChoise = false)
- {
- _index = 0;
- dialog.text = text;
- dialog.isHaveChoise = isHaveChoise;
- }
- public void ShowDialog(Dialog player, Dialog other)
- {
- while (true)
- {
- if (_index >= player.text.Length && _index >= other.text.Length) break;
- Console.WriteLine($"\n{player.text[_index]}");
- Console.WriteLine($"\n{other.text[_index]}");
- Console.WriteLine("Enter \"k\" to continue");
- if (Console.ReadKey().KeyChar == 'k')
- {
- UpdateIndex();
- }
- }
- }
- private void UpdateIndex()
- {
- _index++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment