Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using UnityEngine.UI;
  4.  
  5. public class Selection : MonoBehaviour {
  6. public GameObject panel1;
  7. public GameObject panel2;
  8. public GameObject panel3;
  9. Text tex;
  10.  
  11. public bool bool1 = false;
  12. public bool bool2 = false;
  13. public bool bool3= false;
  14. public bool isArcherAtack = false;
  15. public bool isMageAtack = false;
  16. public bool isTrollAtack = false;
  17. public GameObject select1;
  18. public GameObject select2;
  19. public GameObject select3;
  20. public GameObject troll;
  21. public GameObject archer;
  22. public GameObject mage;
  23. public GameObject textt;
  24.  
  25. void Start()
  26. {
  27. tex = textt.GetComponent<Text>();
  28. }
  29.  
  30.  
  31. public void panel1_true() //troll
  32. {
  33. select2.SetActive(false);
  34. select3.SetActive(false);
  35.  
  36. panel1.SetActive(!bool1);
  37. select1.SetActive(bool1);
  38. bool1=!bool1;
  39.  
  40. }
  41. public void panel2_true() //archer
  42. {
  43. select1.SetActive(false);
  44. select3.SetActive(false);
  45. panel2.SetActive(!bool2);
  46. select2.SetActive(bool2);
  47. bool2=!bool2;
  48. }
  49. public void panel3_true() //mage
  50. {
  51. select1.SetActive(false);
  52. select2.SetActive(false);
  53. panel3.SetActive(!bool3);
  54. select3.SetActive(bool3);
  55. bool3=!bool3;
  56. }
  57. public void Attack1_button() //troll
  58. {
  59. troll.GetComponent<Hero>().TrollAttack();
  60. isTrollAtack = true;
  61. panel1.SetActive(false);
  62. select1.SetActive(!isTrollAtack);
  63. select2.SetActive(!isArcherAtack);
  64. select3.SetActive(!isMageAtack);
  65.  
  66. }
  67. public void Attack2_button() //archer
  68. {
  69. archer.GetComponent<Hero>().ArcherAttack();
  70. isArcherAtack = true;
  71. panel2.SetActive(false);
  72. select1.SetActive(!isTrollAtack);
  73. select2.SetActive(!isArcherAtack);
  74. select3.SetActive(!isMageAtack);
  75. }
  76. public void Attck3_butoon() //mage
  77. {
  78. mage.GetComponent<Hero>().MageAttack();
  79. isMageAtack = true;
  80. panel3.SetActive(false);
  81. select1.SetActive(!isTrollAtack);
  82. select2.SetActive(!isArcherAtack);
  83. select3.SetActive(!isMageAtack);
  84. }
  85. public void End_Turn_Button()
  86. {
  87. if ((isMageAtack == true)&&(isArcherAtack == true)&&(isTrollAtack == true))
  88. {
  89. tex.text = "Ход противника";
  90. Invoke("TextChanger",6);
  91. }
  92. }
  93. void TextChanger()
  94. {
  95. tex.text = "End turn";
  96. bool1 = false;
  97. bool2 = false;
  98. bool3= false;
  99. isArcherAtack = false;
  100. isMageAtack = false;
  101. isTrollAtack = false;
  102. select1.SetActive(!isTrollAtack);
  103. select2.SetActive(!isArcherAtack);
  104. select3.SetActive(!isMageAtack);
  105. }
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement