void DetermineActiveChapter() { if (Mathf.Abs(rectTransform.anchoredPosition.y - restingY) > basePanelSeparation / 2) { if (activeChapter < chapterPanels.Length && rectTransform.anchoredPosition.y > restingY) { activeChapter++; UIChapterPanel.UpdateAllRestingY(); } else if (activeChapter > 1 && rectTransform.anchoredPosition.y <= restingY) { activeChapter--; UIChapterPanel.UpdateAllRestingY(); } } }
public void Init() { LevelIsNewlyOpen = LevelManager.GetPlayerLevelStatusChanged(chapterNumber, levelNumber); if (LevelIsNewlyOpen) { button.interactable = false; if (UIChapterPanel.ActiveChapter == chapterNumber && chapterNumber < 4) { lockIcon.PrepareToBreakOpen(); } else { lockIcon.PrepareToBreakOpenAfterShift(); UIChapterPanel.ShiftToNewActivePanel(chapterNumber); } } else { button.interactable = LevelManager.GetPlayerLevelStatus(chapterNumber, levelNumber);; } whitePanel.SetActiveStatus(button.interactable); highScore = LevelManager.GetPlayerLevelHighScore(chapterNumber, levelNumber); maxStarsEarned = LevelManager.GetPlayerLevelMaxStars(chapterNumber, levelNumber); SetUpChildObjects(); if (button.interactable) { for (int i = 0; i < stars.Length; i++) { if (maxStarsEarned > i) { stars[i].ShowGold(); } else { stars[i].ShowGrey(); } } } }
public void moveBallistic(float motion) { pointCurrentY = lastDragY + motion; lastDragY = pointCurrentY; if (activeChapter == 1 && pointCurrentY < pointStartY) { UIChapterPanel.AdjustPanels(((pointCurrentY - pointStartY) / endPanelDragFriction) / Screen.height); } else if (activeChapter == 4 && pointCurrentY > pointStartY) { UIChapterPanel.AdjustPanels(((pointCurrentY - pointStartY) / endPanelDragFriction) / Screen.height); } else { UIChapterPanel.AdjustPanels(((pointCurrentY - pointStartY) / dragFriction) / Screen.height); } }
public void OnDrag(PointerEventData eventData) { pointCurrentY = eventData.position.y; UIChapterPanel.drag = true; momentum = Mathf.Clamp((momentum + (pointCurrentY - lastDragY)) / 2, -maxMomentum, maxMomentum); startmomentum = momentum; lastDragY = pointCurrentY; if (activeChapter == 1 && pointCurrentY < pointStartY) { UIChapterPanel.AdjustPanels(((pointCurrentY - pointStartY) / endPanelDragFriction) / Screen.height); } else if (activeChapter == 4 && pointCurrentY > pointStartY) { UIChapterPanel.AdjustPanels(((pointCurrentY - pointStartY) / endPanelDragFriction) / Screen.height); } else { UIChapterPanel.AdjustPanels(((pointCurrentY - pointStartY) / dragFriction) / Screen.height); } }
public static void ShiftToNewActivePanel(int newActiveChapter) { activeChapter = newActiveChapter; UIChapterPanel.UpdateAllRestingY(); }