Jump to content

Recommended Posts

Posted

  Currently for the cats I am simply doing a lookup of behaviors in the scene and checking for those that implement the satisfier interface. In doing this I can tell if they are something that *could* satisfy the curiosity or needs of a cat. Classically this hasn't been very efficient in Unity and I'm not even sure I need to do it. If we think about it, when assets are created or "destroyed" I'm actually just activating and deactivating them. If we lack a sufficient number of "pooled" assets then I create a new one and add it to the pool.

  Eventually when a player has played long enough they reach a point where no new assets are created or destroyed. This means I've actually got collections of every possible asset already in the spawners. So what I'm thinking we'll do is create a central hub that has all of our spawners and their pools, then we can pass in the ID of the kind of thing we are looking for, food, play, rest. From here we'll check for a source that is available and active in the scene.

  Once those needs are met that object will be assigned to the cat and vice versa (thus removing it from the available pool). If either the asset or the cat is adjusted in any way this will break the link. The cat will become free and the item will be free for other kitties to interact with.

  The only things this won't cover are objects that will be in the world while I'm building, but we can always write a script that skims all that data when a zone is finished, if we assume the items cannot be removed. If they can be removed then simply skimming the map on load and seeing if anything is not currently tracked will be sufficient.

  The last note for future me, I will want this container to live in an SO that is reset on load (when in editor), because we need it to persist between scene transitions, assuming we do full unloads. Time will tell.

×
×
  • Create New...