Hi,
i'm writing a dialog system (first serious attempt) and came to a point where i want to make it more 'unspecific'.
Each dialog currently has options to specify requirements (List of DialogRequirement objects) for it to be a selectable option, which consist
of a target (enum - npc, player, world) and a type (enum -state, logEntry, etc) and a few value fields (int, float, string). When checking the requirements
i select the target based on the enum value and pass the requirement object to it. Targets implement an interface (IDialogRelevant) with bool ValidateRequirement(DialogRequirement) and use the value fields for the check.
The problem i have is that the requirement has these value fields (int intValue, float floatValue ..) that are bad to read and easy to implement wrong in the DialogRelevant entity and also the RequirementType enum too tied to a specific type of game (the requirementType enum currently has things like QuestLog for example).
What i would want is it to be extensible , like new requirement (sub)classes which then could (and should) be more specific.
What i thought, but am confused about is generic interfaces, or an abstract generic baseclass.
(But if, how would i 'connect' these to the specific requirement target and pass the required value and what way should i do it, and wouldn't i have to typecheck and cast these before passing them to the specific target as i have to store them in a baseclass type field?)
i'm using unity (c#) and already have a visual interface ready to build the dialogs, but want it to be open to the requirement types that the user can implement, like i think giving them a Draw() method would be the way (as there's currently only this one requirement object i just inlined the drawing of it).
How would i design it?
I hope you can understand what i mean.