static public void StartCinematic(float duration, CinematicPan panIn = null, CinematicPan panOut = null, CinematicCallback onComplete = null) { if (StartCinematic(panIn, panOut, onComplete)) { _instance.CancelInvoke("StopCinematicInstance"); _instance.Invoke("StopCinematicInstance", duration); } }
private void OnDestroy() { if (_instance == this) { DestroyTopBar(); DestroyBottomBar(); _instance = null; _topBar = null; _bottomBar = null; _panIn = null; _panOut = null; ScreenResizeEvent.onScreenResize -= OnScreenResize; } }
static public void StopCinematic() { if (Cinematic.instance != null) { if (_isCinematicActive) { _topBar.transform.DOMoveY(1.5f, barTweenDuration). SetEase(easeOut); _bottomBar.transform.DOMoveY(-1.5f, barTweenDuration). SetEase(easeOut).OnComplete(OnStopCinematicComplete); if (_panOut != null) { _panOut.PanOut(); _panOut = null; } } } }
static public bool StartCinematic(CinematicPan panIn = null, CinematicPan panOut = null, CinematicCallback onComplete = null) { bool started = false; if (Cinematic.instance != null) { if (!_isCinematicActive) { _isCinematicActive = true; _topBar.enabled = true; _topBar.transform.position = new Vector3(0.0f, 1.5f, 0.0f); _topBar.transform.DOMoveY(1.5f - barSizePercent, barTweenDuration) .SetEase(easeIn); _bottomBar.enabled = true; _bottomBar.transform.position = new Vector3(0.0f, -1.5f, 0.0f); _bottomBar.transform.DOMoveY(-1.5f + barSizePercent, barTweenDuration) .SetEase(easeIn); _panIn = panIn; _panOut = panOut; if (_panIn != null) { _panIn.PanIn(); _panIn = null; } _onComplete = onComplete; started = true; Debug.Log("Cinematic Started"); } } return(started); }