Advertisement
Guest User

Untitled

a guest
Jun 19th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5.  
  6. public class Personagem : MonoBehaviour
  7. {
  8. public InputField Name;
  9. public GameObject Uchihacla1, Sarutobicla2, Naracla3, NinjaShop, Loja;
  10. public GameObject[] UchihaSubClans, SarutobiSubClans, NaraSubClans;
  11. public Character _character;
  12. // Use this for initialization
  13. void Start()
  14. {
  15. _character = new Character();
  16.  
  17. }
  18.  
  19. // Update is called once per frame
  20. void Update()
  21. {
  22. _character.name = Name.text;
  23.  
  24. }
  25. public void SetClan(string claName)
  26. {
  27. _character.clan = claName;
  28. _character.subclan = "";
  29. setAllToFalse();
  30. switch (claName)
  31. {
  32. case "Nara":
  33. NaraSubClans[0].SetActive(true);
  34. NaraSubClans[1].SetActive(true);
  35. break;
  36. case "Uchiha":
  37. UchihaSubClans[0].SetActive(true);
  38. UchihaSubClans[1].SetActive(true);
  39. break;
  40. case "Sarutobi":
  41. SarutobiSubClans[0].SetActive(true);
  42. SarutobiSubClans[1].SetActive(true);
  43. break;
  44. }
  45. }
  46. public void SetSubclan(string subclanName)
  47. {
  48. _character.subclan = subclanName;
  49. }
  50. private void setAllToFalse()
  51. {
  52. for (int i = 0; i < 2; i++)
  53. {
  54. UchihaSubClans[i].SetActive(false);
  55. SarutobiSubClans[i].SetActive(false);
  56. NaraSubClans[i].SetActive(false);
  57. }
  58. public void turnOffAll()
  59. {
  60. setAllToFalse();
  61. Uchihacla1.SetActive(false);
  62. Sarutobicla2.SetActive(false);
  63. Naracla3.SetActive(false);
  64. Name.gameObject.SetActive(false);
  65. NinjaShop.SetActive(false);
  66. Loja.SetActive(true);
  67. }
  68. }
  69. [System.Serializable]
  70. public class Character
  71. {
  72. public string name;
  73. public string clan;
  74. public string subclan;
  75. }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement