Advertisement
Guest User

Untitled

a guest
Nov 12th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5.  
  6.  
  7. public interface IDialog
  8. {
  9. void SystemDialog(Text text, string txt_Active);
  10. void SetDialot(string[] SetWordDialod, string[] GetWorldDialog);
  11. }
  12. public class Dialog : MonoBehaviour
  13. {
  14.  
  15.  
  16. [SerializeField] string[] Dictionary_Positive;//ответы негативные/позитивные от игрока
  17. [SerializeField] string[] Dictionary_Negative;
  18.  
  19. [SerializeField] string[] Answers_Positve;//ответы позитивные/неативные от бота
  20. [SerializeField] string[] Answers_Negative;
  21.  
  22.  
  23. [SerializeField] Text [] Option_text;//варианты ответов
  24.  
  25. [SerializeField] Text DefoultText;//полученый текст от варианта ответа
  26. [SerializeField] int id_Answers = 0, id_TextAnswers = 0;
  27.  
  28. [SerializeField] Intruder intruder_GM;
  29.  
  30. [SerializeField] GameObject GM_Dir;
  31.  
  32. private void Start()
  33. {
  34. if(intruder_GM==null)
  35. intruder_GM = GameObject.Find("SA_Character").GetComponent<Intruder>();
  36.  
  37.  
  38. }
  39.  
  40. public void SetAnswers()
  41. {
  42.  
  43.  
  44.  
  45.  
  46. if (id_Answers >= Dictionary_Positive.Length)
  47. {
  48.  
  49. intruder_GM.IsActiveDirections_Obj = false;
  50. gameObject.SetActive(false);
  51. intruder_GM.isRun = false;
  52.  
  53. }
  54.  
  55. else
  56. {
  57. Option_text[1].text = Dictionary_Positive[id_Answers];
  58. Option_text[0].text = Dictionary_Negative[id_Answers];
  59.  
  60.  
  61. id_Answers++;
  62.  
  63. }
  64.  
  65.  
  66.  
  67. }
  68.  
  69. public void SetTextBotPositive()
  70. {
  71. if (id_Answers >= 1)
  72. {
  73. DefoultText.text = Answers_Positve[id_TextAnswers];
  74. id_TextAnswers++;
  75.  
  76.  
  77. }
  78. }
  79.  
  80. public void Asnwer(int id)
  81. {
  82.  
  83. switch (id)
  84. {
  85.  
  86. case 0:
  87.  
  88. SetTextBotPositive();
  89. SetAnswers();
  90.  
  91. break;
  92. case 1:
  93. gameObject.SetActive(false);
  94. intruder_GM.IsFight = true;
  95. break;
  96. }
  97.  
  98.  
  99.  
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement