The NPCs in our e-learning game will need to be able to interact with the player and the world in addition to following a user-defined path. While the path-following code was easily encapsulated in one file, we will see that a general purpose solution to the first problem requires a more intricate design.
Our solution will be modeled around and function similarly to a question-and-answer system. A number of classes will be required for implementation:
npcCondition: This is the base class for a question that the NPCs logic will ask about the player or the world.
npcResponse: This is the base class for a response that the NPCs logic will invoke if a condition is found to be true.
npcInteraction: This container class ...