Hello,
I finished my first early release of my first game a few weeks ago. It was the first time I made an actual UI that prompted up to the user based on things they did through the game (like a tutorial initially). I did this by using a whole load of boolean fields and storing them in a LevelManager script and then accessing them from various other scripts across the game when certain things occurred (e.g. player moves within a collider of a planet, it checks whether the boolean flag for “first time in the planet” is false and then does something).
So all these booleans look like this:
public bool firstTimeWithinRangeOfMotherhship = false; // first time the player moves
public bool seenMothership = false; // track whether the ship has been seen before
public bool seenFirstResourcePlanet = false; // track whether ship has seen planet before
public bool seenFirstOrbitalMinerPlanet = false; // as above!
public bool firstOrbitalMinerIsMining = false;
public bool resourcesToSaveShipCollected = false;
public bool firstDialogueCompleted = false;
public bool firstMinerBuilt = false;
It all worked fine, but it just didn’t exactly feel like a very neat way to do it. And the use of the variables was spread across all the other scripts so I could see maintenance being a pain.
It’s obviously a very common thing to need to do, to trigger things based on a player doing something for the first time and then not again when it does it a second time… so I just thought I’d check on here whether there is a better way to do this kind of thing.
Thanks in advance.