Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Helper Methods for Scene Loading #93

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

EvroDeveloper
Copy link

@EvroDeveloper EvroDeveloper commented Feb 3, 2025

  • Added LoadLevel methods, supports string barcodes or Crate References, with optional overloads for specific loading scenes.
  • Added FadeLoadLevel methods, same parameters as all the Load level methods, but will trigger a short fadeout to black before loading the level (just like patch 3). Includes an extra bool parameter to specify if it should fade with the fast variant.

Also added the two types of LoadFade barcodes to CommonBarcodes

(this was all done on a chromebook via vscode, there may be errors and stuff)

MelonCoroutines.Start(FadeIntoLevel(new Barcode(levelBarcode), new Barcode(loadLevelBarcode), fastFade));
}

private static IEnumerator FadeIntoLevel(Barcode level, Barcode loadScene, bool fastFade = false)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method has errors, fixed:

private static System.Collections.IEnumerator FadeIntoLevel(Barcode level, Barcode loadScene, bool fastFade = false)
{
    if (fastFade)
    {
        SpawnCrate(CommonBarcodes.Misc.LoadFadeFast, Vector3.zero);
        yield return new WaitForSeconds(0.5f);
    }
    else
    {
        SpawnCrate(CommonBarcodes.Misc.LoadFade, Vector3.zero);
        yield return new WaitForSeconds(2);
    }
    LoadLevel(level.ID, loadScene.ID);
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, should be fixed now!

@EvroDeveloper EvroDeveloper marked this pull request as ready for review February 5, 2025 13:44
Copy link

@HAHOOS HAHOOS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested (pressed the "Load Random Level" in the DefaultMenu which was updated to use FadeLoadLevel. I do not believe it needs more testing than that as most of the code is the same), seems to work just fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants