public void NextChoiceDown(RectTransform Icon) { IconChoice iconChoice = GetIconChoice(Icon); int index = iconChoice.currentIndex + 1; if (WithinIndex(index)) { AudioManager.Instance.PlayEffect(AudioManager.Clip.Click); iconChoice.startingChoice = iconChoice.choice[index]; print("icon choice is: " + iconChoice.startingChoice); iconChoice.currentIndex = index; foreach (Image choice in iconChoice.choice) { if (choice.GetInstanceID() != iconChoice.startingChoice.GetInstanceID()) { choice.color = GetVisibility(choice.color, false); } else { choice.color = GetVisibility(choice.color, true); } } var theIcon = Icon; LeanTween.scale(theIcon, Vector3.one * 1.1f, 0.1f).setOnComplete(() => { LeanTween.scale(theIcon, Vector3.one, 0.1f); }); } else { NextChoiceUp(Icon); } }
public void ChooseRandomIcons() { print("enabled"); foreach (IconChoice Icon in iconChoiceArr) { // get a random number so we can access a random icon choice int index = Random.Range(0, Icon.choice.Count); Icon.currentIndex = index; Icon.startingChoice = Icon.choice[index]; //string tag = Icon.startingChoice.tag; // Get reference to the currect Icon IconChoice currentIcon = Icon; //Icon currentIcon = Icon.Icon; // foreach(IconChoice i in iconChoiceArr) // { // if (i != currentIcon) // { // Image choiceToRemove = i.choice[index]; // i.choice.Remove(choiceToRemove); // } // } foreach (Image choice in Icon.choice) { if (choice.GetInstanceID() != Icon.startingChoice.GetInstanceID()) { choice.color = GetVisibility(choice.color, false); } else { choice.color = GetVisibility(choice.color, true); } } //Icon.startingChoice = Icon.choice } }