IEnumerator SelectCor(SplatItem item) { open = false; canMove = false; for (int i = 0; i < childs.Count; i++) { SplatItem splat = childs[i].GetComponent <SplatItem>(); if (splat.active) { if (i == childs.Count - 1) { yield return(splat.GoToRestCor(splat != item)); } else { StartCoroutine(splat.GoToRestCor(splat != item)); } } } selected = item.gameObject; if (onSelected != null) { onSelected(item.GetText()); } canMove = true; }
public void Select(SplatItem item, bool discreet) { if (!open) { if (selected != null) { selected.gameObject.SetActive(false); } if (childs[0].gameObject.activeSelf) { childs[0].SetActive(false); } selected = item.gameObject; if (!discreet && onSelected != null) { onSelected(item.GetText()); } item.gameObject.SetActive(true); return; } if (!canMove) { return; } if (open) { StartCoroutine(SelectCor(item)); } }