public void ChooseItem() { Cursor.visible = !Cursor.visible; activeItem = activeButton; sprite = Resources.LoadAll <Sprite> ("Arts/items"); icon.ChangeIcon(sprite [activeItem]); audios [activeItem + 9 - (2 * activeItem)].Play(); //unity skomplikowało mi sortowanie audio w tablicy, stad wzor na odp index if (isToggled) { isToggled = !isToggled; } }
public void Start() { pause = FindObjectOfType <PauseMenu> (); buttons = GetComponentsInChildren <Button> (); //player = FindObjectOfType<PlayerController> (); icon = FindObjectOfType <InventoryIcon> (); audios = GetComponents <AudioSource> (); activeButton = 0; activeItem = PlayerPrefs.GetInt("CurrentItem"); itemsCount = PlayerPrefs.GetInt("ItemsCount"); //itemsCount = 9; for (int i = 8; i >= itemsCount; i--) { buttons [i].interactable = false; } sprite = Resources.LoadAll <Sprite> ("Arts/items"); icon.ChangeIcon(sprite [activeItem]); }