Ok, so I have this map where I have several farmers and farms. Each farmer is an instantiation of the farmer node and every farm is an instantiation of the farm node. I have stored all farmers in an array and all farms in a different array.
With every delta, the game should check for idle farmers and empty farms. If there is an idle farmer and an empty farm, the farmer should go to the farm and stay there.
I figure I need to have a bool variable for each farmer and each farm that lets the game identify the object’s condition (idle/busy, empty/full). Then I would cycle through both arrays in order, to match idle farmers to empty farms. That’s easy enough. The only way I can think to do this is to make both arrays bidimensional, so that I can store that property for each object. However, this seems clunky and would get messy if a farm is destroyed or the peasant is killed.
So the question is, is there an easy way to assign a boolean property to each element in the arrays? i.e. Can I somehow add custom properties to my nodes?
As always, thanks very much!