Advertisement
xxsmarioxxs

Untitled

Mar 28th, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.19 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using UnityEngine.SceneManagement;
  6.  
  7. public class KampfStarten : MonoBehaviour
  8. {
  9. [Header("WaffenButton")]
  10. public Button Waffe1, Waffe, Waffe3, Waffe4;
  11. [Header("WaffenText")]
  12. public Text WaffeText1, WaffeText2, WaffeText3, WaffeText4;
  13. [Header("WaffenIcon")]
  14. public Image WaffeIcon1, WaffeIcon2, WaffeIcon3, WaffeIcon4;
  15. [Header("WaffeInBesitz")]
  16. public bool Waffe01, Waffe02, Waffe03, Waffe04;
  17. [Header("WaffeAktiv")]
  18. public bool Waffe01Aktiv, Waffe02Aktiv, Waffe03Aktiv, Waffe04Aktiv;
  19. [Header("Runden")]
  20. public int RundenGespielt;
  21. [Header("Fortschrit")]
  22. public GameObject Fortschrit1, Fortschrit2, Fortschrit3, Fortschrit4;
  23. [Header("BuyButtonTexts")]
  24. public Text BuyButton01, BuyButton02, BuyButton03, BuyButton04;
  25. [Header("FortschritsText")]
  26. public Text Fortschrit02Text, Fortschrit03Text, Fortschrit04Text;
  27. Kampf1 kampf;
  28. [Header("WellenButtons")]
  29. public Button Fünf_Wellen;
  30. public Button Zehn_Wellen;
  31. public Button EineMinuty_Wellen;
  32. public Button EinsdreizigMinuten_Wellen;
  33. public static KampfStarten kampfStarten;
  34. public Button StartButton;
  35. [Header("Fortschritsanzeige")]
  36. public Image Fortschritsanzeige02, Fortschritsanzeige03, Fortschritsanzeige04;
  37. public float maxMission, Fortschritt, currentMission;
  38. Timer Timer;
  39. public Slider slider;
  40.  
  41. void Awake()
  42. {
  43. Timer = FindObjectOfType<Timer>();
  44. if (kampfStarten == null)
  45. {
  46. DontDestroyOnLoad(this.gameObject);
  47. kampfStarten = this;
  48. }
  49. else
  50. {
  51. Destroy(gameObject);
  52. }
  53.  
  54. }
  55.  
  56. private void Start()
  57. {
  58. kampf = FindObjectOfType<Kampf1>();
  59. Waffe01Aktiv = true;
  60. Waffe01 = true;
  61. Fortschrit02Text.text = RundenGespielt + "/60".ToString();
  62. Fortschrit03Text.text = RundenGespielt + "/80".ToString();
  63. Fortschrit04Text.text = RundenGespielt + "/90".ToString();
  64. }
  65.  
  66.  
  67.  
  68. public void FünfWellen()
  69. {
  70. kampf.Wellen += 5;
  71. EinsdreizigMinuten_Wellen.interactable = false;
  72. EineMinuty_Wellen.interactable = false;
  73. Zehn_Wellen.interactable = false;
  74. Fünf_Wellen.interactable = false;
  75. StartButton.interactable = true;
  76. }
  77. public void ZehnWellen()
  78. {
  79. kampf.Wellen += 10;
  80. EinsdreizigMinuten_Wellen.interactable = false;
  81. EineMinuty_Wellen.interactable = false;
  82. Zehn_Wellen.interactable = false;
  83. Fünf_Wellen.interactable = false;
  84. StartButton.interactable = true;
  85. }
  86. public void EineMinuteWellen()
  87. {
  88. // Timer.Zeitt = true;
  89. kampf.Time += 60;
  90. EinsdreizigMinuten_Wellen.interactable = false;
  91. EineMinuty_Wellen.interactable = false;
  92. Zehn_Wellen.interactable = false;
  93. Fünf_Wellen.interactable = false;
  94. kampf.AufZeit = true;
  95. StartButton.interactable = true;
  96. }
  97. public void EinsDreisichMinutyenWellen()
  98. {
  99. //Timer.Zeitt = true;
  100. kampf.Time += 90;
  101. EinsdreizigMinuten_Wellen.interactable = false;
  102. EineMinuty_Wellen.interactable = false;
  103. Zehn_Wellen.interactable = false;
  104. Fünf_Wellen.interactable = false;
  105. kampf.AufZeit = true;
  106. StartButton.interactable = true;
  107. }
  108. public void Starten()
  109. {
  110. SceneManager.LoadScene("Kampf");
  111. }
  112. public void Waffe01Button()
  113. {
  114.  
  115. if (Waffe01 == true)
  116. {
  117.  
  118. WaffeText4.GetComponentInChildren<Text>().text = "Ausrüsten";
  119. WaffeText2.GetComponentInChildren<Text>().text = "Ausrüsten";
  120. WaffeText3.GetComponentInChildren<Text>().text = "Ausrüsten";
  121. }
  122. WaffeText1.GetComponentInChildren<Text>().text = "Aktiv";
  123. Waffe01 = true;
  124. Waffe01Aktiv = true;
  125. Waffe02Aktiv = false;
  126. Waffe03Aktiv = false;
  127. Waffe04Aktiv = false;
  128. if (Waffe02Aktiv == false)
  129. {
  130. BuyButton02.GetComponentInChildren<Text>().text = "Ausrüsten";
  131. }
  132.  
  133. }
  134. public void Waffe02Button()
  135. {
  136. if (RundenGespielt >= 60)
  137. {
  138. if (Waffe02Aktiv == true)
  139. {
  140. Waffe02 = true;
  141.  
  142. WaffeText2.GetComponentInChildren<Text>().text = "Aktiv";
  143.  
  144. }
  145. }
  146. if (Waffe03 == true)
  147. {
  148.  
  149. WaffeText3.GetComponentInChildren<Text>().text = "Ausrüsten";
  150. }
  151.  
  152. if(Waffe02Aktiv == true)
  153. {
  154. WaffeText2.GetComponentInChildren<Text>().text = "Aktiv";
  155.  
  156.  
  157. }
  158. if (Waffe04 == true)
  159. {
  160.  
  161. WaffeText4.GetComponentInChildren<Text>().text = "Ausrüsten";
  162. }
  163. if (Waffe01 == false)
  164. {
  165.  
  166. WaffeText1.GetComponentInChildren<Text>().text = "Ausrüsten";
  167. }
  168. if (RundenGespielt >= 60)
  169. {
  170. Destroy(Fortschrit2);
  171. BuyButton02.GetComponentInChildren<Text>().text = "Aktiv";
  172. WaffeText1.GetComponentInChildren<Text>().text = "Ausrüsten";
  173. Waffe02 = true;
  174. Waffe02Aktiv = true;
  175. Waffe01Aktiv = false;
  176. Waffe03Aktiv = false;
  177. Waffe04Aktiv = false;
  178.  
  179. }
  180. }
  181. public void Waffe03Button()
  182. {
  183. if (RundenGespielt >= 80)
  184. {
  185. if (Waffe03Aktiv == true)
  186. {
  187. Waffe03 = true;
  188. WaffeText3.text = "Aktiv";
  189. WaffeText3.GetComponentInChildren<Text>().text = "Aktiv";
  190. WaffeText1.GetComponentInChildren<Text>().text = "Ausrüsten";
  191. WaffeText2.GetComponentInChildren<Text>().text = "Ausrüsten";
  192. }
  193. }
  194. if (Waffe02 == true)
  195. {
  196.  
  197. WaffeText2.GetComponentInChildren<Text>().text = "Ausrüsten";
  198. }
  199. if (Waffe03Aktiv == true)
  200. {
  201. WaffeText2.GetComponentInChildren<Text>().text = "Aktiv";
  202.  
  203.  
  204. }
  205. if (Waffe04 == true)
  206. {
  207.  
  208. WaffeText4.GetComponentInChildren<Text>().text = "Ausrüsten";
  209. }
  210. if (Waffe01 == false)
  211. {
  212.  
  213. WaffeText1.GetComponentInChildren<Text>().text = "Ausrüsten";
  214. }
  215. if (RundenGespielt >= 80)
  216. {
  217. Destroy(Fortschrit3);
  218. BuyButton03.GetComponentInChildren<Text>().text = "Aktiv";
  219. Waffe03 = true;
  220. Waffe02Aktiv = false;
  221. Waffe01Aktiv = false;
  222. Waffe03Aktiv = true;
  223. Waffe04Aktiv = false;
  224. }
  225. }
  226. public void Waffe04Button()
  227. {
  228. if (RundenGespielt >= 90)
  229. {
  230. Destroy(Fortschrit4);
  231. BuyButton04.GetComponentInChildren<Text>().text = "Aktiv";
  232. Waffe04 = true;
  233. Waffe02Aktiv = false;
  234. Waffe01Aktiv = false;
  235. Waffe03Aktiv = false;
  236. Waffe04Aktiv = true;
  237.  
  238. if (Waffe04Aktiv == true)
  239. {
  240. Waffe04 = true;
  241.  
  242. WaffeText4.GetComponentInChildren<Text>().text = "Aktiv";
  243. WaffeText1.GetComponentInChildren<Text>().text = "Ausrüsten";
  244. WaffeText2.GetComponentInChildren<Text>().text = "Ausrüsten";
  245. WaffeText3.GetComponentInChildren<Text>().text = "Ausrüsten";
  246. }
  247. }
  248. if (Waffe04 == true)
  249. {
  250.  
  251. WaffeText4.GetComponentInChildren<Text>().text = "Ausrüsten";
  252. }
  253. if (Waffe04Aktiv == true)
  254. {
  255. WaffeText4.GetComponentInChildren<Text>().text = "Aktiv";
  256.  
  257.  
  258. }
  259. if (Waffe04Aktiv == true)
  260. {
  261.  
  262. WaffeText3.GetComponentInChildren<Text>().text = "Ausrüsten";
  263. }
  264. if (Waffe01 == false)
  265. {
  266.  
  267. WaffeText1.GetComponentInChildren<Text>().text = "Ausrüsten";
  268. }
  269.  
  270. }
  271.  
  272. public void JoJoJo()
  273. {
  274. RundenGespielt += 60;
  275. RundenAktualiesieren();
  276. }
  277. public void FortschritsUpdate()
  278. {
  279. if (RundenGespielt <= 60)
  280. {
  281. currentMission = currentMission + Fortschritt;
  282. Fortschritsanzeige02.GetComponent<Image>().fillAmount = currentMission / 100f;
  283. print("Yes");
  284. }
  285. if (RundenGespielt >= 60)
  286. {
  287. currentMission = currentMission + Fortschritt;
  288. Fortschritsanzeige03.GetComponent<Image>().fillAmount = currentMission / 100f;
  289. print("2");
  290. }
  291. if (RundenGespielt >= 80)
  292. {
  293. currentMission = currentMission + Fortschritt;
  294. Fortschritsanzeige04.GetComponent<Image>().fillAmount = currentMission / 100f;
  295. }
  296. }
  297. public void RundenAktualiesieren()
  298. {
  299. Fortschrit02Text.text = RundenGespielt.ToString() + "/60";
  300. Fortschrit03Text.text = RundenGespielt.ToString() + "/80";
  301. Fortschrit04Text.text = RundenGespielt.ToString() + "/90";
  302. }
  303.  
  304. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement