- Home /
Best approach to a interaction management system
I have a small sandbox world with various objects that can be interacted with. Each object has a set of possible interactions (slightly like The Sims). I'm trying to work out the best approach to managing the unique logic for each task, and assigning various objects with the various tasks. An example would be a Tree with the 3 interactions "Shake", "Climb" and "Chop down".
I've been considering a singleton approach with each method defined in some "TaskManager" class, or maybe a delegate and event approach (not sure how this would be implemented in this case).
Has anyone got any good suggestions for this type of system. Cheers, Caius.
Answer by IndieScapeGames · Aug 01, 2012 at 09:00 PM
I would be interested in a similar system.
Perhaps your TaskManager class would be a good idea. Checking the object's tag could pull up a list of interactions. There would have to be certain criteria set up to make interactions only possible within a certain radius of the other objects, or certain checks to ensure that the objects have all requirements met.
The example you shared about the tree, allow me to think of a scavenger who is looking for resources. If he is within a radius of 10m and then interacts with the tree, if he wants food he may "shake", if he's escaping attack from a wild animal or another player, he may "climb", or if he is collecting resources such as wood he may "Chop Down".
We should create an Asset for Unity's Asset Store :)
Lol thats the exact thoughts I had! Nice suggestion. I've had various ideas about how to approach this programatically but I would really like someone to point me towards some examples.
Well I will put something together and share with you later. I've favorite-ed this so I can easily find this topic again later.