public void CloseAlbum() { m_animator.SetTrigger("Out"); Transform t; while (pages.Count > 0) { t = pages[0]; pages.RemoveAt(0); Destroy(t.gameObject); } open = false; SystemsController.RunningAlbum(open); }
public void ShowAlbum() { open = true; SystemsController.RunningAlbum(true); m_animator.SetTrigger("In"); bool front = true; PageBehavior page = Instantiate(pagePrefab, pageContainer).GetComponent <PageBehavior>(); pages.Add(page.transform); for (int cardListIndex = 0; cardListIndex < playerCards.List.Count; cardListIndex++) { // troca de página if (cardListIndex % cardsByPage == 0 && cardListIndex != 0) { if (front) { front = !front; } else { page = Instantiate(pagePrefab, pageContainer).GetComponent <PageBehavior>(); pages.Add(page.transform); page.transform.SetAsFirstSibling(); front = !front; } } Card card; if (front) { card = Instantiate(cardPrefab, page.front).GetComponent <Card>(); } else { card = Instantiate(cardPrefab, page.back).GetComponent <Card>(); } card.Setup(playerCards.List[cardListIndex]); } }