For Those Interested in Making Enum Predicates

I was delighted when @Brian_Trotter shared here that using Enums for the Predicates was possible, that I wanted to share how I did it with the community:
Predicate.cs

namespace RPG.Core
{
    public enum PredicateEnum
    {
        None,
        HasQuest,
        HasInventoryItem,
        CompletedQuest
    }
}

Then for IPredicateEvaluator, I simply changed string predicate to PredicateEnum predicate

The resulting errors should then show you where to change it similarly in QuestList.cs and Inventory.cs :joy:

Finally, I updated the Cases in the two, formatting like this:

case PredicateEnum.HasInventoryItem:
2 Likes

Incredible job! You really want above and beyond. Brian’s stuff is amazing and very helpful.

1 Like