La domanda è off-topic o non pertinente
QuestSystem: the right way
The problem
Hi guys, I read a lot about QuestSystem but everytime I found only bad monobehaviour-based patterns that I really don't like ("use triggers...!", "use colliders...!", ecc... I hate this kind of programming). [My english is not good ;)]
So, I decided to write a QuestSystem based to interfaces and events, but are 2 days that I'm stuck with the event system.
The objects
I will try to summarize, I have:
IQuestObjective: an interface with UpdateProgress() method and OnComplete event; it's a simple task for complete a quest.
Quest: an object with a List of IQuestObjective. In this way, for example, a single Quest can have multiple tasks. For each objectives the quest adds itself to the OnComplete event. So, when all of the objectives are completed, the quest will too.
Various type of IQuestObjective like CollectionObjective (collect this, this and that), InteractionObjective (talk with P), LocationObjective (go to K position), etc...
A lot of other stuff.
The problem is that I'm stuck with the event system network between the QuestManager, the Player, the locations, the npcs, ecc...
Questions
I will take the example of the InteractionObjective (talk with X). Every NPC monobehaviour has a Character model assigned to, with some cool informations and stuff like the dialogues he has to show when the player interact with, or the quests he has to show. All of these interactions are done inside an Interact() method.
What should be the right flow and what are the events I must to implement? Should be the QuestManager to managed all the event flow? How?
It's the first time I'm approaching to a "complex" event system and I have a lot to learn. Unfortunately I think the best way is always "try and try and try...".
If you need I can post my code, but is a lot of code and a lot of classes (OOP)
The Answers main area is best for simple 1-time help on a common problem. I moved this into the Answers HelpRoom area, but only because that's more informal.
The Forums (lower top bar, 1st item) non-commercial collaboration area is probably more suited for a lengthy discussion Q like this.
As far as using triggers, that's just the easiest way for Unity (I think most game engines) to send events.
Thanks a lot, you're right. I'll try in the forum.
Follow this Question
Related Questions
Is it OK to create lots of event listeners? 0 Answers
Unexplainable NullReferenceException? 1 Answer
UnityEvent not showing extension methods 2 Answers
RPG instantiate problem 3 Answers
Will this work? 0 Answers