Jump to content

Part 2 of the Quest to Collect a Kitty


Oafkad

Recommended Posts

Here we are, a late night, I've worked out and even played a bit of games. But still we need to update on what was accomplished with the game. To put it simply, a bit more than I expected and yet I wish I had done more. Tonight we managed to accomplish adding in the Handler class for Moosecat Gameobjects, then we hooked in the Moosecat Datum to that Handler.

From here we integrated the interactable interface and told it that, for now, we want that to add the pet kitty to our care. This isn't necessarily how it'll work in the future but we are just trying to prove the function calls will work as intended.

The first cube is our inventory item example, think like an apple on the ground. The second is our Moosecat. We don't have that object be pooled because, at least currently, it would continue to exist in the tangible world once under your care. Finally, I wanted to see how quickly I could hook up saving and loading. Because being able to save and load gives us the power of progression and really is the foundation of an entire game experience.

First, dang I really messed up how small I made that video, anyways. As we can (kinda) see here, we recover our last known position currently, and we restore our data for the Moosecats and the inventory. And that's that! It was quick and easy and a nice proof of concept for some of the systems I've built. We even update the artifacts that link to these data containers. So other objects can trivially gain access to them without actually having a direct reference to the object itself.

This will be critical when switching scenes or even just spawning the player. Hopefully the state machine will prevent race conditions but it is also nice to just make them hard, if not impossible, to really happen in the first place. And yes, I'm aware that Unity is single thread and so technically you can't have race conditions. But you know what I mean.

Next I believe we'll be hooking up a spawner. This way we can actually remove the cat that is currently in the scene by default and tell the spawner to generate it at load. This will be useful for all sorts of objects in the future.

 

Link to comment
Share on other sites

×
×
  • Create New...