This demo quest requires the player to walk through three colorful cubes -- red, green, blue -- which unlocks the "Lucky Treasure".
In the Demo Scene, there's a big red cube. When the player walks into the cube, it disappears, and a green cube appears. Walking into that makes it disappear and a blue cube appear. Finally, walking into the blue cube makes it disappear, and also completes a Quest.
While much of the Quest system is built for you, the nuances of how Quests work in your game is unique to your game, and some custom coding may be required to handle specific circumstances. The cubes and trigger scripts on them in the demo scene are an example of how you may create custom scripts to push data into the Quest system.
View the "Red Zone" object in the Inspector to see the scripts "Color Cube Zone Trigger" and "Quest Trigger Bool" to see how those work.
View the Quest object in the Inspector:Assets/InfinityPBR/---Game Modules/_Demo Files/Demo Files - Quests/Demo - Group Quests
The Quest is called "Push the Buttons". In the Inspector, we can see that the Quest will Subscribe to Blackboard. This is required for a quest to auto complete or fail, as it will use the Blackboard to get the data it needs to know whether Quest Conditions have been met.
Sequential Steps is also true, which means the Quest Steps will be checked only if the prior steps have been completed successfully. Otherwise, all Quest Steps will be checked for success or failure at all times, and can be completed in any order.
When Sequential Steps is true, it is possible for Quest Steps later in the list to be completed prior to an earlier step. The system will not check the later steps until prior steps are completed. If a step is marked complete and the next step is already complete, it will also be marked complete on the next frame.
Auto Succeed is also marked true. This means the system will automatically check if the Quest succeeds or fails. In this demo, there are no failure conditions, so the Auto Fail option has no impact.
In the demo scene, the "Lucky Treasure" button starts out red, and is locked. Clicking the button will show a Debug.Log indicating the treasure is locked. View the "Lucky Treasure Box" object in the Inspector to see action for the UI Button, and the DemoQuestLockedBox.cs component.
This script controls the logic for the box, and is also the receiver for QuestEvent objects.
Inheriting from QuestFollower provides the basic plumbing required, but Quest DemoLockBox.cs has the specific logic for its own purposes.
DemoQuestLockedBox.cs inherits from QuestFollower, which is a script you can use in your own project. QuestFollower implements IFollowQuests and has all the needed methods for doing so.
You can override the Receive() method to run your own logic depending on the use case in your project.