IEnumerator RandomSelectAbility(int useItemAmount) { isSelectStart = true; int index = 0; int tempIndex = 0; float time = 0; UI_Manager.instance.PopupInterActiveCover.SetActive(true); Random.InitState(User.gachaSeed); int selectedIndex = Random.Range(0, abilitySlotList.Count); User.gachaSeed = Random.Range(0, 1000); SelectImage.GetComponent <Image>().enabled = true; while (time < 1) { tempIndex = Random.Range(0, abilitySlotList.Count); if (tempIndex == index) { index = Mathf.Clamp(tempIndex + 1, 0, abilitySlotList.Count - 1); } else { index = tempIndex; } SelectImage.transform.SetParent(abilitySlotList[index].transform); SelectImage.transform.localPosition = Vector3.zero; SoundManager.instance.EffectSourcePlay(AudioClipManager.instance.ui_button_default); yield return(new WaitForSeconds(Mathf.Clamp(1.0f - (time * 2), 0.1f, 1))); time += 0.05f; } while (index == selectedIndex) { index += 1; if (index > abilitySlotList.Count - 1) { index = 0; } SelectImage.transform.SetParent(abilitySlotList[index].transform); SelectImage.transform.localPosition = Vector3.zero; SoundManager.instance.EffectSourcePlay(AudioClipManager.instance.ui_button_default); yield return(new WaitForSeconds(0.1f)); } SelectImage.transform.SetParent(abilitySlotList[selectedIndex].transform); SelectImage.transform.localPosition = Vector3.zero; yield return(new WaitForSeconds(0.3f)); SoundManager.instance.EffectSourcePlay(AudioClipManager.instance.ui_pop); UI_Manager.instance.PopupInterActiveCover.SetActive(false); SelectImage.GetComponent <Image>().enabled = false; isSelectStart = false; if (ItemSystem.UseItem(ItemSystem.GetUserScroll().customId, useItemAmount)) { AbilitySystem.SetObtainAbility(abilityList[selectedIndex].id); MissionSystem.AddClearPoint(MissionSystem.ClearType.TotalUseScroll, useItemAmount); RefreshUI(); UI_Manager.instance.PopupGetAbility(abilityList[selectedIndex]); } else { RefreshUI(); } yield return(null); }