I have been working on a scenario which involves two worlds: A main game (GameWorld) world and an "item shop" (StoreWorld) where the user can buy upgrades and ammo between levels.
What would be an effective way to pass information back and forth? For example, I want to bring the player's current gold and ammo counts with me to the store, and bring back the same info when I'm done. I don't want anything else about the state of the main game to change.
I have a few ideas floating around my head on how to go about this, but I wanted to check in for some guidance before I start coding blindly. Here are my ideas:
1. Construct a StoreWorld owned by GameWorld. Create a constructor in StoreWorld to allow passing of values into StoreWorld. The problem - I have no idea how to pass information back. Worlds don't have return types! I thought about passing an entire StoreWorld into the GameWorld, which would allow it to call methods on StoreWorld's actors, but still no way to go back...
2. Create a MasterWorld and then sub worlds of it. The MasterWorld would own the GameWorld, StoreWorld, and all the Actors. I have no idea if this is even possible - it's just something that popped into my mind.
I have read the limited documentation and studied the example, but I just can not seem to figure out how to create this more complex scenario.