IEnumerator AnimInNewPanel(PollockPanel curPanel, string swipeDirection) { yield return(new WaitForSeconds(0.4f)); _CurPanel = Instantiate(curPanel, PanelContainer.transform) as PollockPanel; _CurPanel.Init(swipeDirection); }
void InitPollockPanel(int newPanel = 0) { string swipeDirection = "left"; //if we have a current panel, have to move out and destroy if (_CurPanel != null) { if (newPanel > _CurPanelInt) { _CurPanel.Destroy("left"); } else { _CurPanel.Destroy("right"); swipeDirection = "right"; } } _CurPanelInt = newPanel; PollockPanel curPanel = PollockPrefabs[_CurPanelInt]; StartCoroutine(AnimInNewPanel(curPanel, swipeDirection)); //_CurPanel = Instantiate(curPanel, PanelContainer.transform) as PollockPanel; //_CurPanel.Init(); //PollockPanel1 pollockPanel = Instantiate(Panel1Prefab, PanelContainer.transform) as PollockPanel1; //pollockPanel.Init(); }
void ClearPanels() { foreach (Transform child in PanelContainer.transform) { GameObject.Destroy(child.gameObject); } _CurPanel = null; }