public void SwitchScreen(UIScreenManager nextScreen, Vector2 direction, float duration) { // Creates a new screen, animates this into the view and animates the current screen out of view // The new screen is now the current screen UIScreenManager nextScreenInstance = Instantiate(nextScreen, transform); nextScreenInstance.Animate(-direction, direction, duration, false, false); currentScreen.Animate(Vector2.zero, direction, duration, true, false); currentScreen = nextScreenInstance; if (currentOverlayScreen != null) { currentOverlayScreen.Animate(Vector2.zero, direction, duration, true, false); } }
public void PresentOverlay(UIScreenManager overlayScreen, Vector2 direction, float duration) { if (currentOverlayScreen != null) { return; } UIScreenManager overlayScreenInstance = Instantiate(overlayScreen, transform); overlayScreenInstance.Animate(-direction, direction, duration, false, false); currentOverlayScreen = overlayScreenInstance; // Deactivate buttons on underlying screen DeactivateScreen(currentScreen); }