Hi all! I’m pretty new to coding and I’m trying to make an endless runner in which every X seconds a new “world” would be generated with different obstacles and what not, and I’m having problems with implementing that. This is what I have right now:
void Update () {
GenerateNewWorld();
}
void GenerateNewWorld()
{
if (spawnedTiles <= 10)
{
GenerateWorldOne();
}
else if (spawnedTiles > 10)
{
GenerateWorldTwo();
}
}
void GenerateWorldOne()
{
// Instantiate stuff for World One
spawnedTiles++;
}
void GenerateWorldTwo()
{
// Instantiate stuff for World Two
spawnedTiles++;
}
Basically I’m not sure how to create something that would hold all the functions (GenerateWorldOne, etc.) and then it would randomly call a function from it. I tried to figure something out with the Fisher-Yates shuffle but I wasn’t able to come up with something that would actually work.
Sorry if that sounds pretty basic and thanks for your help!