Repeat Node¶
The Repeat node is used when you want to run a single or a sequence of Actions multiple times.
How to Setup a Repeat Node¶
In this tutorial we will make a sequence of Actions to repeat 3 times. In particular we will first dip a sterile cotton ball into alcohol, then we will rub the patient’s arm with the cotton ball to disinfect. We will repeat this process 3 times.
Create the two Actions we mentioned above. Those will be both Use Actions.
For a more detailed tutorial on Use Actions, you can look here
Action 1: Use the cotton ball on the alcohol bottle.
The Use Object is the cotton ball and the Use Collider the alcohol bottle.
Action 2: Use the cotton ball on the patients arm.
The Use Object is the cotton ball and the Use Collider a holographic are over the patient’s arm.
Note
Make sure to add a trigger collider to the holograhic area. In this way the action will trigger with the Use Object.
We also set the holographic area to destroy on perform.
The image below shows the final result with the two Actions linked in line.
Now we will set the loop (repeat) functionality. On the scenegraph editor press right click and select
New Action > Repeat
.The repeat node will appear.
Drag and drop the above 2 Use Actions inside the repeat node and make sure to connect them as the image below:
Note
To remove an Action node from the repeat node press Shift
and drag the node out of it.
Set the
Repeat Count
variable according to how many times you want to repeat the Action. In our case we set it to 3.Delete any prefabs you created from the scene and save the scenegraph.
How to Perform¶
The repeat loop will break when the user sterilizes the area and applies medication 3 times.