How to implement a VR task (plot) system in Unity

I. Introduction

Recently, I worked on a VR project, which contained a large number of plots and VR operation tasks.
For example:
1. What did Zhang San say and what did he do, and then what did Li Si say and what animation did he do? mouse click) to interact with it.
2. We use the VR handle or mouse to interact frequently with an object or instrument in the scene.
3. Some selective operations appear in the VR scene, and different operations enter different plot branches. For example, the UI selects Yes|No, the object selects A|B, etc. When you select Yes or touch A, you will enter the A branch plot. On the contrary, if you choose B, you will enter the B branch.
4. The plot is pushed to the middle, and if some operations are done wrong, the rollback operation can be supported and the selection can be made again.
5. To start a task, you can choose different modes, such as teaching mode, practice mode, assessment mode, etc.
Based on such a requirement, I developed a task system or plot system, TaskFramework, so that we can complete the plot based on data-driven, To put it bluntly, we configure the data and the project starts running.

2. Framework structure

Let's briefly talk about the basic structure of TaskFramework (hereinafter referred to as TF).
First of all, let’s talk about the core control class of TF, TaskManager, which is the total control of our entire task system. I split it into a Model to facilitate the reading of control data. In fact, the core code is a List of TaskData. Step-by-step process. Each step of Task may contain one or more goals. Goal is the actual operation, such as activating objects and playing animations. Goal instructions are driven by command mode.

Guess you like

Origin blog.csdn.net/qq563129582/article/details/129014760