Advertisement
Guest User

Teste

a guest
Jun 19th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.89 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5.  
  6. public class CharacterManager : MonoBehaviour {
  7.  
  8.     public InputField name;
  9.     public Character _character;
  10.     public GameObject FogoBTN, AguaBTN, TerraBTN, EnviarLoja, Loja;
  11.     public GameObject[] FogoSubClans, AguaSubClans, TerraSubClans;
  12.  
  13.     // Use this for initialization
  14.     void Start ()
  15. {
  16.         _character = new Character();
  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 clanName)
  26.     {
  27.         _character.clan = clanName;
  28.         _character.subclan = "";
  29.         setAllToFalse();
  30.     }
  31.  
  32.         public void turnOffAll()
  33.     {
  34.         setAllToFalse();
  35.         FogoBTN.SetActive(false);
  36.         AguaBTN.SetActive(false);
  37.         TerraBTN.SetActive(false);
  38.         name_.gameObject.SetActive(false);
  39.         SendBTN.SetActive(false);
  40.         Shop.SetActive(true);
  41.     }
  42.  
  43.         switch (clanName)
  44.     {
  45.  
  46.         {
  47.             case "Fogo":
  48.                 FogoSubClans[0].SetActive(true);
  49.                 FogoSubClans[1].SetActive(true);
  50.                 break;
  51.             case "Agua":
  52.                 AguaSubClans[0].SetActive(true);
  53.                 AguaSubClans[1].SetActive(true);
  54.                 break;
  55.             case "Terra":
  56.                 TerraSubClans[0].SetActive(true);
  57.                 TerraSubClans[1].SetActive(true);
  58.                 break;
  59.         }
  60.     }
  61.  
  62.     public void SetSubclan(string subclanName) {
  63.         _character.subclan = subclanName;
  64.     }
  65.  
  66.     private void setAllToFalse() {
  67.         for(int i = 0; i < 2; i++) {
  68.             FogoSubClans[i].SetActive(false);
  69.             AguaSubClans[i].SetActive(false);
  70.             TerraSubClans[i].SetActive(false);
  71.         }
  72.     }
  73. }
  74.  
  75.  
  76. [System.Serializable]
  77. public class Character
  78. {
  79.     public string name;
  80.     public string clan;
  81.     public string subclan;
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement