meniku / NPBehave

Event Driven Behavior Trees for Unity 3D
MIT License
1.15k stars 195 forks source link

Blackboard indexer-based setter and getter #7

Closed Xerios closed 7 years ago

Xerios commented 7 years ago

Why have blackboard.Set("test", true) when you can blackboard["test"] = true same goes for blackboard.GetBool("test") which is now blackboard.Get<bool>("test"). The later allows you to get any type of value, and if the value is not found it returns default(bool) instead of the current hardcoded default value.

P.S. you can also do (bool)blackboard["test"], but that's for crazy people.

Xerios commented 7 years ago

Woops, last comment should've been "a more flexible getter".

meniku commented 7 years ago

thanks a lot!

I re-added the old GetXXX-Style methods for backwards compatibility (marked them obsolete). Also note that the default value for GetFloat (NaN) is different from Get<float> (0)

meniku commented 7 years ago

hi @Xerios I improved the debugger a little bit. I added a rough overview over most features to the Readme: NPBehave Debugger

meniku commented 7 years ago

Have to redo the Overview some time when I have more time, there are lots of typos in it

Xerios commented 7 years ago

Oh sweet you're alive. Time scale is a nice addition I gotta say 👍

Btw, I was trying to visualize the tree horizontally at some point, I think I half finished it but then I reverted without committing just to make this pull request. I'll look it up and commit it in a separate branch once I have time, the only thing that was missing were the lines connecting the nodes but I'm not sure.

I'm currently busy making some utility ai stuff for an experimental demo. There's probably few ideas I can transfer to this project :)

meniku commented 7 years ago

oh yeah, recently started to port over one of my AIs to NPBehave from a small sideproject I'm doing with a friend. Once that's finished I plan to release a new version of NPBehave on the unity asset store with all the small fixed and improvements, and your new Debugger of course. So if you have some changes pending you want to have included there, you gotta be fast with committing ;-)