1. закрыть персонажей для выбора со второго например. сделать их платными
2. как сделать чтобы при закрытом персонаже появилась кнопка купить? (ну я сделала две кнопки) выбрать и купить. вот как вобще вставить эту кнопку и покупать и потом чтоб запоминал что купили? По индексу считать?
вот сам код выбора:
Синтаксис:
Используется csharp
private GameObject[] characterList;
private int index;
public GameObject Canvas_main;
public GameObject Can_selec, Can_100, Can_300, Can_500, Can_1000;
public float count=300;
public Text count_public;
void Update(){
count_public.text = count.ToString ();
}
void Start () {
index = PlayerPrefs.GetInt ("CharacterSelected");
characterList = new GameObject[transform.childCount];
for (int i =0; i< transform.childCount; i++)
characterList [i] = transform.GetChild (i).gameObject;
foreach (GameObject go in characterList)
go.SetActive (false);
if (characterList [index])
characterList [index].SetActive (true);
}
public void ToggleLeft()
{
characterList [index].SetActive (false);
index--;
if (index < 0)
index = characterList.Length - 1;
characterList [index].SetActive (true);
}
public void ToggleRight()
{
characterList [index].SetActive (false);
index++;
if (index == characterList.Length)
index = 0;
characterList [index].SetActive (true);
}
public void ConfirmButton()
{
PlayerPrefs.SetInt ("CharacterSelected", index);
Canvas_main.SetActive(true);
}