Predicate Enums

Anyone know of any downside to converting the predicate conditions to an enum? Feels like it would be muuuuch easier and more straightforward to not be comparing strings in code and in the inspector. Just the drop down list like we do for mouse cursors. I also think that there is a way to pre-index enums? So if you go change the order around it won’t mess with stuff since it is already set manually?

I can see Sam just going with strings for simplicity state maybe, but the enum way isn’t really any more complex I don’t think. Which is why I am asking here if anyone can think of a reason we wouldn’t do it that way.

As a personal preference I try to avoid using enums in Unity. But I also didn’t like the string properties we used.

For the quest objectives I made a custom property drawer that displays all the quest objectives in a popup and allowed me to select them instead of typing it in. It shouldn’t be too hard to figure something out for predicate parameters.

But again, it’s just personal preference.

1 Like

You may want to check out my tutorial on improving conditions. The first part of this changes the string Predicate to an Enum. It also includes property drawers for the Disjunction and Conjunction classes.

6 Likes

Oh this is great! Thanks Brian!
I will have to study this later on for sure. For my project it will mostly be checks for faction/standing and previous quests completed. Objectives will mostly be easy. My project is going to really lean in to the absurdity of the typical fetch quests in RPGs. Make it the whole game!

That sort of thing can be a lot of fun. Like in the beginning sequence of A Bard’s Tale, where our intrepid newbie hero is sent into the basement to kill a weak little rat, and winds up facing a boss for his trouble.

2 Likes

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms