Combined Action

A Combined Action has the attribute to perform multiple sub-actions sequentially. Sub-actions consist of any other type of Actions described in this section.

For example, to have an Insert Action followed by a Remove Action but consider both as one whole action, use the Combined Action prototype as described in this section.

To create a Combined Action follow the same ideology as the other prototypes with the difference that you need to define a gameobject for each sub-action you wish to insert.

For example,

public class AssembleKnossosPartOfAction : CombinedAction
{
    public override void Initialize()
    {
        AnalyticsManager.AddScoringFactor<ForceScoringFactor>(2);

        //InsertAction sub-Action
        InsertAction insertFrontGateAction = gameObject.AddComponent<InsertAction>();
        insertFrontGateAction.SetInsertPrefab("Lesson0/Stage1/Action0/FrontPartInteractable",
                                              "Lesson0/Stage1/Action0/FrontPartFinal");
        insertFrontGateAction.SetHoloObject("Lesson0/Stage1/Action0/Hologram/FrontPartHologram");

        //--------------------------------------------------------------------------------------------
        //InsertAction sub - Action
        InsertAction insertBackGateAction = gameObject.AddComponent<InsertAction>();
        insertBackGateAction.SetInsertPrefab("Lesson0/Stage1/Action0/BackPartInteractable",
                                             "Lesson0/Stage1/Action0/BackPartFinal");
        insertBackGateAction.SetHoloObject("Lesson0/Stage1/Action0/Hologram/BackPartHologram");
        //--------------------------------------------------------------------------------------------
        //ToolAction sub - Action
        ToolAction hitWithMallet = gameObject.AddComponent<ToolAction>();
        hitWithMallet.SetToolActionPrefab("Lesson0/Stage1/Action0/BackPartHitMallet", ovidVR.toolManager.tool.ToolsEnum.Mallet);
        hitWithMallet.SetHoloObject("Lesson0/Stage1/Action0/Hologram/MalletHologramL0S1A0");

        InsertIActions(insertFrontGateAction, insertBackGateAction, hitWithMallet);

        base.Initialize();
    }
}

Action Script Explanation

The action prototype gameobjects are first defined and later set using each prototype’s rule (e.g., an Insert Action needs SetInsertPrefab, a Tool Action needs SetToolActionPrefab, and so on).

Finally, you need to finalize the Combined Action’s setup by calling an InsertAction’s function with parameters the sub-actions objects you created before.