@@ -210,6 +210,8 @@ private void Update()
210210 DoSwitchScene ( ) ;
211211 }
212212
213+ #region Load Scene
214+
213215 /// <summary>
214216 /// Load the target scene.
215217 /// </summary>
@@ -399,6 +401,10 @@ public void LoadScene(string sceneName, float fadeInTime, Color screenColor, boo
399401 scs . SWITCHING_SCENE = true ;
400402 }
401403
404+ #endregion
405+
406+ #region Reload Scene
407+
402408 /// <summary>
403409 /// Reload the current scene.
404410 /// </summary>
@@ -492,6 +498,115 @@ public void ReloadScene(float fadeInTime, Color screenColor, bool keepBGM)
492498 LoadScene ( sceneName , fadeInTime , screenColor , keepBGM ) ;
493499 }
494500
501+ #endregion
502+
503+ #region Next Scene
504+
505+ /// <summary>
506+ /// Return the next scene.
507+ /// </summary>
508+ public Scene NextScene ( int offset = 1 )
509+ {
510+ int nextIndex = SceneManager . GetActiveScene ( ) . buildIndex + offset ;
511+
512+ return SceneManager . GetSceneByBuildIndex ( nextIndex ) ;
513+ }
514+
515+ /// <summary>
516+ /// Load the next scene.
517+ /// </summary>
518+ public void LoadNextScene ( )
519+ {
520+ // NOTE(jenchieh): get the fade in time base on
521+ // the scene setting and scene manager specific.
522+ float fadeInTime = JCS_SceneSettings . instance . SceneFadeInTimeBaseOnSetting ( ) ;
523+
524+ // load scene and pass the value in.
525+ LoadNextScene ( fadeInTime ) ;
526+ }
527+
528+ /// <summary>
529+ /// Load the next scene.
530+ /// </summary>
531+ /// <param name="fadeInTime"> Time to fade in. </param>
532+ public void LoadNextScene ( float fadeInTime )
533+ {
534+ LoadNextScene ( fadeInTime , false ) ;
535+ }
536+
537+ /// <summary>
538+ /// Load the next scene.
539+ /// </summary>
540+ /// <param name="screenColor"> Screen color to fade in/out. </param>
541+ public void LoadNextScene ( Color screenColor )
542+ {
543+ var ss = JCS_SceneSettings . instance ;
544+
545+ // NOTE(jenchieh): get the fade in time base on the scene setting
546+ // and scene manager specific.
547+ float fadeInTime = ss . SceneFadeInTimeBaseOnSetting ( ) ;
548+
549+ LoadNextScene ( fadeInTime , screenColor , false ) ;
550+ }
551+
552+ /// <summary>
553+ /// Load the next scene.
554+ /// </summary>
555+ /// <param name="keepBGM"> Set to true if keep background music playing. </param>
556+ public void LoadNextScene ( bool keepBGM )
557+ {
558+ var ss = JCS_SceneSettings . instance ;
559+
560+ // NOTE(jenchieh): get the fade in time base on the scene setting
561+ // and scene manager specific.
562+ float fadeInTime = ss . SceneFadeInTimeBaseOnSetting ( ) ;
563+
564+ LoadNextScene ( fadeInTime , ss . SCREEN_COLOR , keepBGM ) ;
565+ }
566+
567+ /// <summary>
568+ /// Load the next scene.
569+ /// </summary>
570+ /// <param name="fadeInTime"> Time to fade in. </param>
571+ /// <param name="keepBGM"> Set to true if keep background music playing. </param>
572+ public void LoadNextScene ( float fadeInTime , bool keepBGM )
573+ {
574+ var sceneS = JCS_SceneSettings . instance ;
575+
576+ LoadNextScene ( fadeInTime , sceneS . SCREEN_COLOR , keepBGM ) ;
577+ }
578+
579+ /// <summary>
580+ /// Load the next scene.
581+ /// </summary>
582+ /// <param name="screenColor"> Screen color to fade in/out. </param>
583+ /// <param name="keepBGM"> Set to true if keep background music playing. </param>
584+ public void LoadNextScene ( Color screenColor , bool keepBGM )
585+ {
586+ var ss = JCS_SceneSettings . instance ;
587+
588+ // NOTE(jenchieh): get the fade in time base on the scene setting
589+ // and scene manager specific.
590+ float fadeInTime = ss . SceneFadeInTimeBaseOnSetting ( ) ;
591+
592+ LoadNextScene ( fadeInTime , screenColor , keepBGM ) ;
593+ }
594+
595+ /// <summary>
596+ /// Load the next scene.
597+ /// </summary>
598+ /// <param name="fadeInTime"> Time to fade in. </param>
599+ /// <param name="screenColor"> Screen color to fade in/out. </param>
600+ /// <param name="keepBGM"> Set to true if keep background music playing. </param>
601+ public void LoadNextScene ( float fadeInTime , Color screenColor , bool keepBGM )
602+ {
603+ string sceneName = NextScene ( ) . name ;
604+
605+ LoadScene ( sceneName , fadeInTime , screenColor , keepBGM ) ;
606+ }
607+
608+ #endregion
609+
495610 /// <summary>
496611 /// Check is loading the scene or not.
497612 /// </summary>
0 commit comments