private IEnumerator MoveTo(EEcran NextScreen, bool ToLeft) { ConfigEcran Config = GetConfig(Current); Vector3 StartPosition = Camera.transform.position; if (Config.ToLeftZ != Config.ToRightZ) { StartPosition.z = (ToLeft ? Config.ToRightZ : Config.ToLeftZ); } Config = GetConfig(NextScreen); Vector3 EndPosition = StartPosition; EndPosition.z = (ToLeft ? Config.ToLeftZ : Config.ToRightZ); float StartTime = Time.time; while (Time.time < StartTime + DureeTransition) { float Progress = (Time.time - StartTime) / DureeTransition; Camera.transform.position = Vector3.Lerp(StartPosition, EndPosition, Progress); yield return(null); } FinishTransitionTo(NextScreen, ToLeft); }
private void FinishTransitionTo(EEcran NextScreen, bool ToLeft) { Current = NextScreen; ConfigEcran Config = GetConfig(Current); Vector3 EndPosition = Camera.transform.position; EndPosition.z = (ToLeft ? Config.ToLeftZ : Config.ToRightZ); Camera.transform.position = EndPosition; if (Footer != null) { if (Config.ShowFooter) { Footer.SetActive(true); } } if (Config.ShowHeader) { Header.SetActive(true); } if (Config.UIScreen != null) { Config.UIScreen.SetActive(true); } MoveInProgress = false; }
private void StartTransitionTo(EEcran NextScreen, bool ToLeft) { if (MoveInProgress == true) { return; } MoveInProgress = true; ConfigEcran Config = GetConfig(NextScreen); CloseAllPopups(); if (Footer != null) { if (!Config.ShowFooter) { Footer.SetActive(false); } } if (!Config.ShowHeader) { Header.SetActive(false); } Config = GetConfig(Current); if (Config.UIScreen != null) { Config.UIScreen.SetActive(false); } StartCoroutine(MoveTo(NextScreen, ToLeft)); }
public ConfigEcran GetConfig(EEcran Ecran) { return(Config.Find(T => T.Type == Ecran)); }