Action Prototypes

namespace MAGES::ActionPrototypes

namespace MAGES::AutomaticDestroy

namespace MAGES::AutomaticDestroyFunctions

class MAGES::ActionPrototypes::AnimationAction::AnimationGroup Helper class to group the animation Action prefabs

class [MAGES::ActionPrototypes::BasePrototype::InstrumentTransforms::CustomTransfrom] (#classovid_v_r_1_1_action_prototypes_1_1_base_prototype_1_1_instrument_transforms_1_1_custom_transfrom) Instrument transformation values

class MAGES::ActionPrototypes::BasePrototype::HoloGroup Helper class for holograms

class MAGES::ActionPrototypes::RemoveAction::InsertGroup For Remove Action we need an extra class to group the prefabs that will be spawned

class MAGES::ActionPrototypes::InsertAction::InsertGroup Helper class to group the insert Action prefabs

class MAGES::ActionPrototypes::BasePrototype::InstrumentTransforms This class is used to store information about the instrument’s position There are some cases we want to know the position of an instrument to spawn another one relative to this position. This methodology is used in actions that user assembles instrumets. Since user handles the instruments with shis hand we need to sknow where those intstruments (or his hands) are located.

class MAGES::AutomaticDestroyFunctions::AutomaticObjectDestroyFuncs::PlayAnimationAfterEnable Interal class need to Play again animation if the action is perform before the animation finish Automatic removed when it is finished

class MAGES::ActionPrototypes::PumpAction::PumpGroup For Pump Action we need an extra class to group the prefabs that will be spawned

namespace MAGES::ActionPrototypes

Summary

class MAGES::ActionPrototypes::AnimationAction

class MAGES::ActionPrototypes::BasePrototype Base Prototype contains all the shared variables and methods other Action prototypes have It encaptulates the basic functionality to run ang configure each Action All Action prototypes inherit from Base prototype and override the needed functions

class MAGES::ActionPrototypes::CombinedAction The combined is used to perform actions that consist of multiple sub-actions sequentially. An example of combined action is when you want to open a door. This can be described as OpenDoorAction consisting of PullHandleAction and PullDoorAction. In general, the combined action is used to describe an action that in order to be performed, the user needs to perform 2 or more ‘smaller’ actions.

class MAGES::ActionPrototypes::InsertAction Insert Action is referring to a specific type of Action that user has to insert an object to a specific position in order to complete it. For such an action we need three basic elements. First the Interactable prefab which is the object user will grab using his virtual hands or any other input device. The second one is the position we have to place the object. This position is called the Final position of our prefab. The correct orientation of the interactable object relative to the Final position is the key element to complete the Action. The final element to complete the prototyping of an Insert Action is to use a hologram to indicate the correct final position of the hologram. An Insert Action can have many objects to be inserted to the final position. For this reason we can set many prefabs in one Action.

class MAGES::ActionPrototypes::PumpAction The Pump Action is used in situations where the user needs to press a button or a tool (e.g. syringe) It is also used in Actions where user needs to to use a tool (e.g. syringe) to insert liquid or air by making the pump gesture (technically pressing the trigger button). In those Actions we need an object for user to interact with and press the trigger button from the controller (as many times he set beforehand) to Perform the Action.

class MAGES::ActionPrototypes::QuestionAction

class MAGES::ActionPrototypes::RemoveAction Remove Action describes a step of the procedure which user has to remove an object using his hands or a tool.To implement a Remove Action we have to set the object that will be removed.This object will spawn as the removable prefab and to complete the Action user needs to reach and remove it.The removable prefab will flash to indicate that it needs to be removed to complete the Action.Remove Action also supports removing an object using a tool instead of hands. This tool can be a pair of plyers or another tool that supports the grab mechanism.

class MAGES::ActionPrototypes::ToolAction Tool Action is referring to an Action that user has to take a tool and use it to complete the action.Technically speaking, a Tool Action needs only a set of colliders to trigger a specific tool when they will come in contact.This set of colliders are referring as the Collider prefab and contain the necessary information for the selected tool to trigger them.

class MAGES::ActionPrototypes::UseAction Use Action is similar to a Tool Action but instead of a tool we use another object to complete the Action.In order to properly set the Action we have to spawn the collider prefab(as the tool Action) but in this case we also need to provide an extra object to interact with (instead of the tool).

class MAGES::ActionPrototypes::AnimationAction

class MAGES::ActionPrototypes::AnimationAction
  : public MAGES.ActionPrototypes.BasePrototype

Summary

public inline virtual override void Initialize() Initialize method for Animation Action overrides base.Initialize() and 1)Spawns all animation prefabs from the prefab list 2)Sets the counter that will Perform the Action to the number of the animated prefabs

public inline virtual override void Perform() Perform method for Animation Action overrides base.Perform() and 1)Finalizes all Animation prefabs 2)Clears Action Lists

public inline virtual override void Undo() Undo method for Animation Action overrides base.Undo() and 1)Destroys Animation Prefabs 2)Clears Action Lists

public inline AnimationGroup SetAnimationPrefab(string grabbablePrefabPath,GameObject parentGameObject,InheritTransformFrom _inheritTransformGrabbale) Set prefabs for a single instrument

protected List< AnimationGroup>animationGroupsList This list contains all the animations objects of current Action User needs to play all of the animations to perform the Action

Members

public inline virtual override void Initialize()

Initialize method for Animation Action overrides base.Initialize() and 1)Spawns all animation prefabs from the prefab list 2)Sets the counter that will Perform the Action to the number of the animated prefabs

public inline virtual override void Perform()

Perform method for Animation Action overrides base.Perform() and 1)Finalizes all Animation prefabs 2)Clears Action Lists

public inline virtual override void Undo()

Undo method for Animation Action overrides base.Undo() and 1)Destroys Animation Prefabs 2)Clears Action Lists

public inline AnimationGroup SetAnimationPrefab(string grabbablePrefabPath,GameObject parentGameObject,InheritTransformFrom _inheritTransformGrabbale)

Set prefabs for a single instrument

Parameters
  • grabbablePrefabPath The prefab user will grab with animation

protected List< AnimationGroup>animationGroupsList

This list contains all the animations objects of current Action User needs to play all of the animations to perform the Action

class MAGES::ActionPrototypes::BasePrototype

class MAGES::ActionPrototypes::BasePrototype
  : public MonoBehaviour
  : public IAction

Base Prototype contains all the shared variables and methods other Action prototypes have It encaptulates the basic functionality to run ang configure each Action All Action prototypes inherit from Base prototype and override the needed functions

Summary

{property} string ActionName

{property} GameObject ActionNode

public inline virtual void Initialize() Initialize function of BasePrototype sets the shared elements of all Action Prototypes for the Action to run properly These are the event Listeners, the set of physical colliders and the reset of all counters Initialize is a virtual function since it can be overridden from each Action

public inline virtual void Perform() Perform function of BasePrototype clears current Action to get ready for the next one It also runs all the Unity Actions in performActionList The process of cleaning the current Action includes the deletion of prefabs (holograms), reseting the Event Manager, the kill of Voice Actor and clearing the list of Actions This method is overridden by any Action

public inline virtual void Undo() Undo function of Base Prototype has the same functionalities with Perform but instead of running the performActionList it runs the Actions in undoActionList This method is overridden by any Action

public inline virtual void ActionCall() ActionCall method is called when a trigger event from ACtions occur. An Action has its own Listener and performs an ActionCall (this method) on a specific situation For example in a Tool Action when the correct tool hits one of teh colliders then ActionCall() is triggered This method is overridden by any Action

public inline virtual void InitializeHolograms() InitializeHologram method is used to spawn the selected hologram in the current Action This method is overridden by any Action

public inline virtual void DifficultyRestrictions() DifficultyRestrictions performs different functionalities depending on the difficulty level Easy: Holograms,Easy ErrorColliders, Aidlines Medium: Medium ErrorColliders Hard: Hard Colliders This method is overridden by any Action

public inline virtual void SetNextModule(Action action) Connects the next Action in a combined Action A combimed Action has many actions to perform before going to the next one This methid links the next Action of current combined Action with the given Action

public inline void SetAidLine(string spawnAidLine) Sets the aidLines for the specific action

public inline void SetAfterSpawnAction(Action afterSpawnFunction) Sets a Unity Action to run right after Action’s Initialization

public inline void SetErrorColliders(string _errorCollidersPath) Set the error colliders for the Action

public inline void SetUndoAction(Action undoActionFunction) Set an action to play on Undo()

public inline void SetPerformAction(Action performActionFunction,int numOfTriggerToPlay) Set an action to play after a numner of triggers. It will also play on Perform if Not triggererd

public inline void SetHoloObject(string holoPath,GameObject finalPrefabParent) Set the hologram for the Action

public inline void ColliderPrefabCallBackOnTimerChange(params Action< float >[] _callBacks)

Parameters

public inline void SetEventListener(string _event) Sets Event Listener for the current Action Event Listener is being set with a string key that is most of the times the Action’s name Event Manager binds this key with the ActionCall of BasePrototype to Run when the trigger from the Action occurs

public inline void SetPhysicalColliderPrefab(string _physicalColliderPath) Sets the string path for the ACtion’s phusical colliders Physical colliders of an Action are all those colliders that are static and non triggered

public inline void SetNextAction(int lessonID,int stageID,int actionID)

protected Dictionary< int, Action > performActionList Dictionary that contains Unity Actions to run on Perform For Tool Action you can use the key (int) to set a Unity Action to run after specific collider triggers For example: SetPerformAction(MAGES.CharacterController.CharacterController.instance.PlayCut2Animation, 2); Which plays PlayCut2Animation on the second trigger event of Collider prefab

protected List< Action > undoActionList List of Unity Actions to execute (Same idea with performActionList) but this time runs on Undo. Important: Triggers BEFORE scenegraph changes to next Action

protected Action ActionCallOverrideOnFinish This unity Action is set to the next Action that will run after performing this one This variable is for combined Actions and remains null otherwise

protected GameObject errorColliders A reference to the errorColliders gameObject

protected string physicalColliderPath A string varible to store the path to the physicalColliderPath prefab

protected GameObject physicalCollider A reference to the physicalCollider gameObject

protected int callBackCounter A counter to store how many times a specific action the has called its trigger event

protected int callBackEnd Counter to set how many trigger events are nedded to Perform the action

protected List< Action< float > > colliderPrefabCallBackOnTimerChange This variable is used from Tool and Use Actions to set and restore the use/tool timing

protected inline void StopFlashing() Stops controllers flashing

protected inline GameObject Spawn(string _path,GameObject _parent,InheritTransformFrom _inheritTrans) Spawns the prefabs for the current action. Beforehand we have store the paths to those prefabs so now its the time to spawn them

protected inline void DestroyHolograms() Destroys current Action Holograms

enum ControllerFlashing Enumerator to set the proper flashing

enum InheritTransformFrom Enumerator to define the positional inheritance of spawned GameObject Used when we want to spawn a prefab relative to another position eg. Users hand, as part of another tool

Members

{property} string ActionName
{property} GameObject ActionNode
public inline virtual void Initialize()

Initialize function of BasePrototype sets the shared elements of all Action Prototypes for the Action to run properly These are the event Listeners, the set of physical colliders and the reset of all counters Initialize is a virtual function since it can be overridden from each Action

public inline virtual void Perform()

Perform function of BasePrototype clears current Action to get ready for the next one It also runs all the Unity Actions in performActionList The process of cleaning the current Action includes the deletion of prefabs (holograms), reseting the Event Manager, the kill of Voice Actor and clearing the list of Actions This method is overridden by any Action

public inline virtual void Undo()

Undo function of Base Prototype has the same functionalities with Perform but instead of running the performActionList it runs the Actions in undoActionList This method is overridden by any Action

public inline virtual void ActionCall()

ActionCall method is called when a trigger event from ACtions occur. An Action has its own Listener and performs an ActionCall (this method) on a specific situation For example in a Tool Action when the correct tool hits one of teh colliders then ActionCall() is triggered This method is overridden by any Action

public inline virtual void InitializeHolograms()

InitializeHologram method is used to spawn the selected hologram in the current Action This method is overridden by any Action

public inline virtual void DifficultyRestrictions()

DifficultyRestrictions performs different functionalities depending on the difficulty level Easy: Holograms,Easy ErrorColliders, Aidlines Medium: Medium ErrorColliders Hard: Hard Colliders This method is overridden by any Action

public inline virtual void SetNextModule(Action action)

Connects the next Action in a combined Action A combimed Action has many actions to perform before going to the next one This methid links the next Action of current combined Action with the given Action

Parameters
  • action The nect Action to link the combined Action

public inline void SetAidLine(string spawnAidLine)

Sets the aidLines for the specific action

public inline void SetAfterSpawnAction(Action afterSpawnFunction)

Sets a Unity Action to run right after Action’s Initialization

Parameters
  • afterSpawnFunction The Action to run

public inline void SetErrorColliders(string _errorCollidersPath)

Set the error colliders for the Action

public inline void SetUndoAction(Action undoActionFunction)

Set an action to play on Undo()

public inline void SetPerformAction(Action performActionFunction,int numOfTriggerToPlay)

Set an action to play after a numner of triggers. It will also play on Perform if Not triggererd

Parameters
  • numOfTriggerToPlay The number of triggers to play

public inline void SetHoloObject(string holoPath,GameObject finalPrefabParent)

Set the hologram for the Action

public inline void ColliderPrefabCallBackOnTimerChange(params Action< float >[] _callBacks)
Parameters
  • _callBacks

public inline void SetEventListener(string _event)

Sets Event Listener for the current Action Event Listener is being set with a string key that is most of the times the Action’s name Event Manager binds this key with the ActionCall of BasePrototype to Run when the trigger from the Action occurs

Parameters
  • _event The string key to bind the Event Manager with BasePrototype’s Action Call

public inline void SetPhysicalColliderPrefab(string _physicalColliderPath)

Sets the string path for the ACtion’s phusical colliders Physical colliders of an Action are all those colliders that are static and non triggered

Parameters
  • _physicalColliderPath Path to the physical collider prefab

public inline void SetNextAction(int lessonID,int stageID,int actionID)
protected Dictionary< int, Action > performActionList

Dictionary that contains Unity Actions to run on Perform For Tool Action you can use the key (int) to set a Unity Action to run after specific collider triggers For example: SetPerformAction(MAGES.CharacterController.CharacterController.instance.PlayCut2Animation, 2); Which plays PlayCut2Animation on the second trigger event of Collider prefab

protected List< Action > undoActionList

List of Unity Actions to execute (Same idea with performActionList) but this time runs on Undo. Important: Triggers BEFORE scenegraph changes to next Action

protected Action ActionCallOverrideOnFinish

This unity Action is set to the next Action that will run after performing this one This variable is for combined Actions and remains null otherwise

protected GameObject errorColliders

A reference to the errorColliders gameObject

protected string physicalColliderPath

A string varible to store the path to the physicalColliderPath prefab

protected GameObject physicalCollider

A reference to the physicalCollider gameObject

protected int callBackCounter

A counter to store how many times a specific action the has called its trigger event

protected int callBackEnd

Counter to set how many trigger events are nedded to Perform the action

protected List< Action< float > > colliderPrefabCallBackOnTimerChange

This variable is used from Tool and Use Actions to set and restore the use/tool timing

protected inline void StopFlashing()

Stops controllers flashing

protected inline GameObject Spawn(string _path,GameObject _parent,InheritTransformFrom _inheritTrans)

Spawns the prefabs for the current action. Beforehand we have store the paths to those prefabs so now its the time to spawn them

Parameters
  • _path Path of the prefab we want to spawn

  • _parent GameObject to spawn under a parend. By default null

  • _inheritTrans Transformation of another object to spawn relative to this position

Returns
protected inline void DestroyHolograms()

Destroys current Action Holograms

enum ControllerFlashing

TriggerButton
GripButton
NoFlashing

Enumerator to set the proper flashing

enum InheritTransformFrom

none
grabbablePrefab
finalPrefab
removePrefab

Enumerator to define the positional inheritance of spawned GameObject Used when we want to spawn a prefab relative to another position eg. Users hand, as part of another tool

class MAGES::ActionPrototypes::CombinedAction

class MAGES::ActionPrototypes::CombinedAction
  : public MAGES.ActionPrototypes.BasePrototype

The combined is used to perform actions that consist of multiple sub-actions sequentially. An example of combined action is when you want to open a door. This can be described as OpenDoorAction consisting of PullHandleAction and PullDoorAction. In general, the combined action is used to describe an action that in order to be performed, the user needs to perform 2 or more ‘smaller’ actions.

public class OpenDoorAction : CombinedAction { public override void Initialize() { UseAction pullHandleAction = gameObject.AddComponent(); pullHandleAction.SetUsePrefab(“Lesson10/Stage0/Action0/pullHandle”); pullHandleAction.SetHoloObject(“Lesson10/Stage0/Action0/Hologram/pullHandleActionHologram”); UseAction pullDoorAction = gameObject.AddComponent(); pullDoorAction.SetUsePrefab(“Lesson10/Stage0/Action0/pullDoor”); pullDoorAction.SetHoloObject(“Lesson10/Stage0/Action0/Hologram/pullDoorHologramb”);

InsertIActions(pullHandleAction, pullDoorAction); base.Initialize(); } }

Summary

public inline virtual override void Initialize() Initialize method for Combined Action overrides base.Initialize() and 1)Deletes and Undoes all previous Actions to set the combined Action 2)Sets the event Listener for current Combined Action

public inline virtual override void Perform() Perform method for Combined Action overrides base.Perform() and 1)Performs current sub-Action and Initializes next sub-Action If this is the last sub-Action of Combined Action then Perform the Action 2)Sets event listener to teh next Action

public inline virtual override void Undo() Undo method for Combined Action overrides base.Undo() and 1)Undoes Each Action from iActionListQueue 2)Clears Lists 3)Calls undoActionList Actions 4)Resets and initializes Actions

public inline virtual override void DifficultyRestrictions() DifficultyRestrictions method for Combined Action overrides base.DifficultyRestrictions() Sets Holograms depending on the difficulty level

public inline virtual override void SetNextModule(Action action) Set the next module for the last element of queue

public inline void InsertIActions(params IAction[] iActions) Inserts sub-Action to Action Queue

public inline void NextModuleFinish() Method to manage sub-Action performs 1)Performs current active sub-Action 2)Sets event Listener for the next sub-Action 3)Initializes next sub-Action

public inline void SetEventListenerCombined(string _event) Sets the Event listener with the given key

public inline new void SetPerformAction(Action performActionFunction,int numOfTriggerToPlay) Set an action to play after a numner of triggers. It will also play on Perform if Not triggererd

public inline new void SetUndoAction(Action undoActionFunction) Set an action to play on Undo()

public inline int GetCurrentSubActionName()

Members

public inline virtual override void Initialize()

Initialize method for Combined Action overrides base.Initialize() and 1)Deletes and Undoes all previous Actions to set the combined Action 2)Sets the event Listener for current Combined Action

public inline virtual override void Perform()

Perform method for Combined Action overrides base.Perform() and 1)Performs current sub-Action and Initializes next sub-Action If this is the last sub-Action of Combined Action then Perform the Action 2)Sets event listener to teh next Action

public inline virtual override void Undo()

Undo method for Combined Action overrides base.Undo() and 1)Undoes Each Action from iActionListQueue 2)Clears Lists 3)Calls undoActionList Actions 4)Resets and initializes Actions

public inline virtual override void DifficultyRestrictions()

DifficultyRestrictions method for Combined Action overrides base.DifficultyRestrictions() Sets Holograms depending on the difficulty level

public inline virtual override void SetNextModule(Action action)

Set the next module for the last element of queue

Parameters
  • action Next sub-Action to enQueue

public inline void InsertIActions(params IAction[] iActions)

Inserts sub-Action to Action Queue

Parameters
  • iActions Action to set

public inline void NextModuleFinish()

Method to manage sub-Action performs 1)Performs current active sub-Action 2)Sets event Listener for the next sub-Action 3)Initializes next sub-Action

public inline void SetEventListenerCombined(string _event)

Sets the Event listener with the given key

Parameters
  • _event String key to bind current Action call to Event Manager

public inline new void SetPerformAction(Action performActionFunction,int numOfTriggerToPlay)

Set an action to play after a numner of triggers. It will also play on Perform if Not triggererd

Parameters
  • numOfTriggerToPlay The number of triggers to play

public inline new void SetUndoAction(Action undoActionFunction)

Set an action to play on Undo()

public inline int GetCurrentSubActionName()

class MAGES::ActionPrototypes::InsertAction

class MAGES::ActionPrototypes::InsertAction
  : public MAGES.ActionPrototypes.BasePrototype

Insert Action is referring to a specific type of Action that user has to insert an object to a specific position in order to complete it. For such an action we need three basic elements. First the Interactable prefab which is the object user will grab using his virtual hands or any other input device. The second one is the position we have to place the object. This position is called the Final position of our prefab. The correct orientation of the interactable object relative to the Final position is the key element to complete the Action. The final element to complete the prototyping of an Insert Action is to use a hologram to indicate the correct final position of the hologram. An Insert Action can have many objects to be inserted to the final position. For this reason we can set many prefabs in one Action.

Example of Insert Action: Insert Trial Polyethylene to Tibia. To set this action we have to spawn the interactable polyethylene on a surgical table, the final position of polyethylene and lastly the hologram for the polyethylene in the correct position. To complete the Action user needs to grab the polyethylene and place it with the correct rotation on the final position that the hologram indicates.

public class PolyethyleneTrialAction : InsertAction { public override void Initialize() { SetInsertPrefab(“Lesson7/Stage2/Action0/Polyethylene”, “Lesson7/Stage2/Action0/PolyethyleneFinal”, “Lesson7/Stage2/Action0/Hologram/HologramL7S2A0”); base.Initialize(); } }

Summary

public inline virtual override void Initialize() Initialize method for Insert Action overrides base.Initialize() and 1)Destroys all final prefabs from remoteDestroyPrefabsList 1)Spawns all insert prefabs from the prefab list 2)Sets the counter that will Perform the Action to the number of the inserted prefabs

public inline virtual override void Perform() Perform method for Insert Action overrides base.Perform() and 1)Finalizes all insert prefabs 2)Clears Action Lists

public inline virtual override void Undo() Undo method for Insert Action overrides base.Undo() and 1)Destroys insert Prefabs 2)Clears Action Lists

public inline InsertGroup SetInsertPrefab(string grabbablePrefabPath,string finalPrefabPath,GameObject finalPrefabParent,GameObject grabbableParent,InheritTransformFrom _inheritTransformGrabbale,InheritTransformFrom _inheritTransformFinal) Set prefabs for a single instrument

protected List< InsertGroup>insertGroupsList This list contains all the insert objects of current Action User needs to insert all of them to perform the Action

Members

public inline virtual override void Initialize()

Initialize method for Insert Action overrides base.Initialize() and 1)Destroys all final prefabs from remoteDestroyPrefabsList 1)Spawns all insert prefabs from the prefab list 2)Sets the counter that will Perform the Action to the number of the inserted prefabs

public inline virtual override void Perform()

Perform method for Insert Action overrides base.Perform() and 1)Finalizes all insert prefabs 2)Clears Action Lists

public inline virtual override void Undo()

Undo method for Insert Action overrides base.Undo() and 1)Destroys insert Prefabs 2)Clears Action Lists

public inline InsertGroup SetInsertPrefab(string grabbablePrefabPath,string finalPrefabPath,GameObject finalPrefabParent,GameObject grabbableParent,InheritTransformFrom _inheritTransformGrabbale,InheritTransformFrom _inheritTransformFinal)

Set prefabs for a single instrument

Parameters
  • grabbablePrefabPath The prefab user will grab

  • finalPrefabPath The final position of the instrument

  • hologramPath The hologram of the final position

protected List< InsertGroup>insertGroupsList

This list contains all the insert objects of current Action User needs to insert all of them to perform the Action

class MAGES::ActionPrototypes::PumpAction

class MAGES::ActionPrototypes::PumpAction
  : public MAGES.ActionPrototypes.BasePrototype

The Pump Action is used in situations where the user needs to press a button or a tool (e.g. syringe) It is also used in Actions where user needs to to use a tool (e.g. syringe) to insert liquid or air by making the pump gesture (technically pressing the trigger button). In those Actions we need an object for user to interact with and press the trigger button from the controller (as many times he set beforehand) to Perform the Action.

A pump Action needs a single or multiple pump prefabs The pump prefab should have the following components: 1) MAGESInteractableItem with small drop distance (0.08) and a rigidbody 2) NetworkIdentity and MAGESNetTransform for Coop 3) MAGESAutoAttach to enable the hand lock mechanic automatically 4) PumpPrefabConstructor and PumpBehaviour with the configured settings and animations 5) MAGESEnableDisableOnAttach for the hand lock mechanic. We suggest to set both hands 6) AudioSource in case the pump Action makes any sound 7) Collider to enable the auto attach mechanic when triggered with the hands

Example of Pump Action: Inflate Balloon Catheter In this Action user needs to take a syringe and inflate the balloon catheter. The first step is to place the syringe on the catheter (insert Action). To perform the Pump Action he/she needs to hover his hand on top of the syringe, then the hand lock mechanic will be enabled and his hand will lock in place (first frame from the recorded animation) to register the pump, user needs to press the trigger button. By pressing the trigger button the syringe will start playing the prerecorded animation according to the input from the trigger button. The Action will Perform when the user completes the desired amount of pumps.

Pump Actions can register different pump prefabs within the same Action by calling the SetPumpPrefab method multiple times. In this case the Action will perform as soon as user completes all the pumps from all the different prefabs

In addition the SetPumpPrefab method has an optional argument (performActionFunction) that a developer can use to invoke a method after completing all the pumps of the spawned pump prefab (e.g the SyringePumping)

public class InflateBalloonCatheter : PumpAction { public override void Initialize() { SetPumpPrefab(“Lesson0/Stage1/Action1/SyringePumping”, catheter);

base.Initialize(); }

}

Summary

public inline virtual override void Initialize() Initialize function of BasePrototype sets the shared elements of all Action Prototypes for the Action to run properly These are the event Listeners, the set of physical colliders and the reset of all counters Initialize is a virtual function since it can be overridden from each Action

public inline virtual override void Perform() Perform function of BasePrototype clears current Action to get ready for the next one It also runs all the Unity Actions in performActionList The process of cleaning the current Action includes the deletion of prefabs (holograms), reseting the Event Manager, the kill of Voice Actor and clearing the list of Actions This method is overridden by any Action

public inline virtual override void Undo() Undo function of Base Prototype has the same functionalities with Perform but instead of running the performActionList it runs the Actions in undoActionList This method is overridden by any Action

public inline void SetWaitForAllPumps(bool wait)

public inline void SetPumpPrefab(string _pumpPrefabPath) Sets a single pump prefab

public inline void SetPumpPrefab(string _pumpPrefabPath,GameObject _pumpParent,Action _performActionFunction) Sets a single pump prefab

public inline void SetPumpPrefab(string _pumpPrefabPath,Action _performActionFunction) Sets a single pump prefab

Members

public inline virtual override void Initialize()

Initialize function of BasePrototype sets the shared elements of all Action Prototypes for the Action to run properly These are the event Listeners, the set of physical colliders and the reset of all counters Initialize is a virtual function since it can be overridden from each Action

public inline virtual override void Perform()

Perform function of BasePrototype clears current Action to get ready for the next one It also runs all the Unity Actions in performActionList The process of cleaning the current Action includes the deletion of prefabs (holograms), reseting the Event Manager, the kill of Voice Actor and clearing the list of Actions This method is overridden by any Action

public inline virtual override void Undo()

Undo function of Base Prototype has the same functionalities with Perform but instead of running the performActionList it runs the Actions in undoActionList This method is overridden by any Action

public inline void SetWaitForAllPumps(bool wait)
public inline void SetPumpPrefab(string _pumpPrefabPath)

Sets a single pump prefab

Parameters
  • _pumpPrefabPath Path to the pump prefab

public inline void SetPumpPrefab(string _pumpPrefabPath,GameObject _pumpParent,Action _performActionFunction)

Sets a single pump prefab

Parameters
  • _pumpPrefabPath Path to the pump prefab

  • _pumpParent Parent for the pump prefab

  • _performActionFunction Action call to invoke after completing all the pumps on a prefab

public inline void SetPumpPrefab(string _pumpPrefabPath,Action _performActionFunction)

Sets a single pump prefab

Parameters
  • _pumpPrefabPath Path to the pump prefab

  • _performActionFunction Action call to invoke after completing all the pumps on a prefab

class MAGES::ActionPrototypes::QuestionAction

class MAGES::ActionPrototypes::QuestionAction
  : public MAGES.ActionPrototypes.BasePrototype

Summary

public bool m_Ready

public inline void SetQuestionPrefab(string _questionPrefabPath)

public inline virtual override void ActionCall() ActionCall method is called when a trigger event from ACtions occur. An Action has its own Listener and performs an ActionCall (this method) on a specific situation For example in a Tool Action when the correct tool hits one of teh colliders then ActionCall() is triggered This method is overridden by any Action

public inline virtual override void DifficultyRestrictions() DifficultyRestrictions performs different functionalities depending on the difficulty level Easy: Holograms,Easy ErrorColliders, Aidlines Medium: Medium ErrorColliders Hard: Hard Colliders This method is overridden by any Action

public inline virtual override void Initialize() Initialize function of BasePrototype sets the shared elements of all Action Prototypes for the Action to run properly These are the event Listeners, the set of physical colliders and the reset of all counters Initialize is a virtual function since it can be overridden from each Action

public inline virtual override void InitializeHolograms() InitializeHologram method is used to spawn the selected hologram in the current Action This method is overridden by any Action

public inline virtual override void Perform() Perform function of BasePrototype clears current Action to get ready for the next one It also runs all the Unity Actions in performActionList The process of cleaning the current Action includes the deletion of prefabs (holograms), reseting the Event Manager, the kill of Voice Actor and clearing the list of Actions This method is overridden by any Action

public inline virtual override void SetNextModule(Action action) Connects the next Action in a combined Action A combimed Action has many actions to perform before going to the next one This methid links the next Action of current combined Action with the given Action

public inline virtual override void Undo() Undo function of Base Prototype has the same functionalities with Perform but instead of running the performActionList it runs the Actions in undoActionList This method is overridden by any Action

Members

public bool m_Ready
public inline void SetQuestionPrefab(string _questionPrefabPath)
public inline virtual override void ActionCall()

ActionCall method is called when a trigger event from ACtions occur. An Action has its own Listener and performs an ActionCall (this method) on a specific situation For example in a Tool Action when the correct tool hits one of teh colliders then ActionCall() is triggered This method is overridden by any Action

public inline virtual override void DifficultyRestrictions()

DifficultyRestrictions performs different functionalities depending on the difficulty level Easy: Holograms,Easy ErrorColliders, Aidlines Medium: Medium ErrorColliders Hard: Hard Colliders This method is overridden by any Action

public inline virtual override void Initialize()

Initialize function of BasePrototype sets the shared elements of all Action Prototypes for the Action to run properly These are the event Listeners, the set of physical colliders and the reset of all counters Initialize is a virtual function since it can be overridden from each Action

public inline virtual override void InitializeHolograms()

InitializeHologram method is used to spawn the selected hologram in the current Action This method is overridden by any Action

public inline virtual override void Perform()

Perform function of BasePrototype clears current Action to get ready for the next one It also runs all the Unity Actions in performActionList The process of cleaning the current Action includes the deletion of prefabs (holograms), reseting the Event Manager, the kill of Voice Actor and clearing the list of Actions This method is overridden by any Action

public inline virtual override void SetNextModule(Action action)

Connects the next Action in a combined Action A combimed Action has many actions to perform before going to the next one This methid links the next Action of current combined Action with the given Action

Parameters
  • action The nect Action to link the combined Action

public inline virtual override void Undo()

Undo function of Base Prototype has the same functionalities with Perform but instead of running the performActionList it runs the Actions in undoActionList This method is overridden by any Action

class MAGES::ActionPrototypes::RemoveAction

class MAGES::ActionPrototypes::RemoveAction
  : public MAGES.ActionPrototypes.BasePrototype

Remove Action describes a step of the procedure which user has to remove an object using his hands or a tool.To implement a Remove Action we have to set the object that will be removed.This object will spawn as the removable prefab and to complete the Action user needs to reach and remove it.The removable prefab will flash to indicate that it needs to be removed to complete the Action.Remove Action also supports removing an object using a tool instead of hands. This tool can be a pair of plyers or another tool that supports the grab mechanism.

Example of Remove Action: Remove osteophytes To set this remove Action we need to spawn the osteophytes with the flashing mechanic and also set the correct parameters that enables removing with tool. Remove Action supports multiple removal of objects.As a result in this example we can set all the osteophytes as removable prefabs within the same Action. To complete the Action we have to take the plyers from the tool table and remove all the osteophytes.

public class RemoveOsteophytesAction : RemoveAction { public override void Initialize() { SetRemovePrefab(“Lesson0/Stage4b/Action0/FemoralSpur1”, femur); SetRemovePrefab(“Lesson0/Stage4b/Action0/FemoralSpur2”, femur); SetRemovePrefab(“Lesson0/Stage4b/Action0/FemoralSpur3”, femur); SetRemovePrefab(“Lesson0/Stage4b/Action0/TibialSpur1”, tibia); SetHoloObject(“Lesson0/Stage4b/Action0/Hologram/HologramL0S4bA0”); SetErrorColliders(“Lesson0/Stage4b/Action0/Restrictions/ErrorsColliders”);

base.Initialize(); } }

Summary

public inline virtual override void Initialize() Initialize method for Remove Action overrides base.Initialize() and 1)Spawns all removable prefabs from the prefab list 2)Sets the counter that will Perform the Action to the number of the removable prefabs

public inline virtual override void Perform() Perform method for Remove Action overrides base.Perform() and 1)Destroys Remove prefabs 2)Clears Action Lists

public inline virtual override void Undo() Undo method for Remove Action overrides base.Undo() and 1)Destroys Remove Prefabs 2)Clears Action Lists

public inline void SetRemovePrefab(string prefabPath,GameObject toBeParent) Set the prefab user will remove

public inline void SetRemovePrefab(string grabbablePrefabPath,string removePrefabPath,GameObject removePrefabParent,InheritTransformFrom _inheritTransformGrabbale,InheritTransformFrom _inheritTransformRemove) Set the prefab user will remove

Members

public inline virtual override void Initialize()

Initialize method for Remove Action overrides base.Initialize() and 1)Spawns all removable prefabs from the prefab list 2)Sets the counter that will Perform the Action to the number of the removable prefabs

public inline virtual override void Perform()

Perform method for Remove Action overrides base.Perform() and 1)Destroys Remove prefabs 2)Clears Action Lists

public inline virtual override void Undo()

Undo method for Remove Action overrides base.Undo() and 1)Destroys Remove Prefabs 2)Clears Action Lists

public inline void SetRemovePrefab(string prefabPath,GameObject toBeParent)

Set the prefab user will remove

Parameters
  • prefabPath

public inline void SetRemovePrefab(string grabbablePrefabPath,string removePrefabPath,GameObject removePrefabParent,InheritTransformFrom _inheritTransformGrabbale,InheritTransformFrom _inheritTransformRemove)

Set the prefab user will remove

Parameters
  • prefabPath

class MAGES::ActionPrototypes::ToolAction

class MAGES::ActionPrototypes::ToolAction
  : public MAGES.ActionPrototypes.BasePrototype

Tool Action is referring to an Action that user has to take a tool and use it to complete the action.Technically speaking, a Tool Action needs only a set of colliders to trigger a specific tool when they will come in contact.This set of colliders are referring as the Collider prefab and contain the necessary information for the selected tool to trigger them.

Example of Tool Action: Cut the cloth using scissors To set this Tool Action we need to spawn the collider that will trigger with the scissors tool.It is also recommended to provide a holographic animated scissors performing the action indicating the correct cut or simple line-dots at the colliders we want to cut. To complete the Action user has to take the scissors from the tool table an cut the spawned tool colliders. When scissors interact with all colliders the Action will perform.

public class CutClothAction : ToolAction { public override void Initialize() { SetToolActionPrefab(“Lesson0/Stage0/Action0/CutClothColliders” , ToolsEnum.Scissors); SetErrorColliders(“Lesson0/Stage0/Action0/Restrictions/ErrorsColliders”); SetHoloObject(“Lesson0/Stage0/Action0/Hologram/HologramL0S0A0”);

base.Initialize(); } }

Summary

public inline virtual override void Initialize() Initialize method for Tool Action overrides base.Initialize() and 1)Spawns tool collider 2)Sets the counter that will Perform the Action if all the colliders will be triggered by the tool IMPORTANT: This collider will be set to the childs of tool collider that will have the ToolTriggerCollider

public inline virtual override void Perform() Perform method for Tool Action overrides base.Perform() and 1)Destroys colldider prefab

public inline virtual override void Undo() Undo method for Tool Action overrides base.Undo() and 1)Destroys tool collider prefab

public inline void SetToolActionPrefab(string prefabPath,ToolsEnum _tool,GameObject _PrefabParent) Set the trigger colliders that will interact with the tool

Members

public inline virtual override void Initialize()

Initialize method for Tool Action overrides base.Initialize() and 1)Spawns tool collider 2)Sets the counter that will Perform the Action if all the colliders will be triggered by the tool IMPORTANT: This collider will be set to the childs of tool collider that will have the ToolTriggerCollider

public inline virtual override void Perform()

Perform method for Tool Action overrides base.Perform() and 1)Destroys colldider prefab

public inline virtual override void Undo()

Undo method for Tool Action overrides base.Undo() and 1)Destroys tool collider prefab

public inline void SetToolActionPrefab(string prefabPath,ToolsEnum _tool,GameObject _PrefabParent)

Set the trigger colliders that will interact with the tool

class MAGES::ActionPrototypes::UseAction

class MAGES::ActionPrototypes::UseAction
  : public MAGES.ActionPrototypes.BasePrototype

Use Action is similar to a Tool Action but instead of a tool we use another object to complete the Action.In order to properly set the Action we have to spawn the collider prefab(as the tool Action) but in this case we also need to provide an extra object to interact with (instead of the tool).

Example of Use Action: Clean statue with a cloth To set this action we have to spawn the cloth and the collider that will interact with. To simulate the cleaning process it is recommended to set the use time variable around 3-5 seconds to wait that much time in contact with the cloth and then trigger the Perform to complete the Action. It is also recommended to spawn an animated hologram to indicate the proper object and the correct way to use it. To complete the action user has to take the cloth and place it on the statue for the amount of time we have set.

public class CleanStatueAction : UseAction { public override void Initialize() { SetUsePrefab(“Lesson0/Stage2/Action0/ClothPrefab”); SetColliderPrefab(“Lesson0/Stage2/Action0/ClothCollider”); SetHoloObject(“Lesson0/Stage2/Action0/Hologram/HologramL0S2A0”);

base.Initialize(); } }

Summary

public inline virtual override void Initialize() Initialize method for Use Action overrides base.Initialize() and 1)Spawns collider and use Prefabs

public inline virtual override void Perform() Perform method for Use Action overrides base.Perform() and 1)Destroys colldider prefab 2)Sets use prefab to be destroyed after thrown by user

public inline virtual override void Undo() Undo method for Use Action overrides base.Undo and 1)Destroys collider and use Prefabs

public inline void SetUsePrefab(string _usePrefabPath,string _colliderPrefabPath,GameObject _colliderParent) Set the Grabbable prefab to use in Action

protected inline GameObject GetUsePrefab()

Members

public inline virtual override void Initialize()

Initialize method for Use Action overrides base.Initialize() and 1)Spawns collider and use Prefabs

public inline virtual override void Perform()

Perform method for Use Action overrides base.Perform() and 1)Destroys colldider prefab 2)Sets use prefab to be destroyed after thrown by user

public inline virtual override void Undo()

Undo method for Use Action overrides base.Undo and 1)Destroys collider and use Prefabs

public inline void SetUsePrefab(string _usePrefabPath,string _colliderPrefabPath,GameObject _colliderParent)

Set the Grabbable prefab to use in Action

Parameters
  • usePrefabPath

protected inline GameObject GetUsePrefab()

namespace MAGES::AutomaticDestroy

Summary

class MAGES::AutomaticDestroy::AutomaticObjectDestroy This script when set to an object, spawn and destroyed it as set in DestroyTime List

class MAGES::AutomaticDestroy::AutomaticObjectDestroy

class MAGES::AutomaticDestroy::AutomaticObjectDestroy
  : public MonoBehaviour

This script when set to an object, spawn and destroyed it as set in DestroyTime List

Summary

public List< DestroyTime > destroyTime Selected the actions where the prefab can be deleted. Leave empty if the prefab is going to be destroyed by the same action that spawned it

Members

public List< DestroyTime > destroyTime

Selected the actions where the prefab can be deleted. Leave empty if the prefab is going to be destroyed by the same action that spawned it

namespace MAGES::AutomaticDestroyFunctions

Summary

class MAGES::AutomaticDestroyFunctions::AutomaticObjectDestroyFuncs Internal class containing all the functionalities for automatic/spawn Destroy objects

class MAGES::AutomaticDestroyFunctions::AutomaticObjectDestroyFuncs

Internal class containing all the functionalities for automatic/spawn Destroy objects

class MAGES::ActionPrototypes::AnimationAction::AnimationGroup

Helper class to group the animation Action prefabs

Summary

public string grabbablePrefabPath Paths to the prefabs that will spawned

public GameObject grabbablePrefab GameObjects to store spawned prefabs

public GameObject parentGameObject Parent GameObject

public InheritTransformFrom inheritGrabbable Transforms of objects we need to spawn the prefabs in relative position

public inline  AnimationGroup(string _grabbablePrefabPath,GameObject _parentGameObject,InheritTransformFrom _inheritGrabbable) Constructor to generate an animation group

Members

public string grabbablePrefabPath

Paths to the prefabs that will spawned

public GameObject grabbablePrefab

GameObjects to store spawned prefabs

public GameObject parentGameObject

Parent GameObject

public InheritTransformFrom inheritGrabbable

Transforms of objects we need to spawn the prefabs in relative position

public inline  AnimationGroup(string _grabbablePrefabPath,GameObject _parentGameObject,InheritTransformFrom _inheritGrabbable)

Constructor to generate an animation group

class MAGES::ActionPrototypes::BasePrototype::InstrumentTransforms::CustomTransfrom

Instrument transformation values

Summary

public Vector3 position

public Quaternion rotation

Members

public Vector3 position
public Quaternion rotation

class MAGES::ActionPrototypes::BasePrototype::HoloGroup

Helper class for holograms

Summary

public string holoPath Path for the prefab

public GameObject holoParent Possible holographic parent

public GameObject holoObject The actual hologram

public inline void SetHoloObject(GameObject _holoObject) Set Hologram Gameobject to class variable

public inline  HoloGroup(string _holoPath,GameObject _holoParent)

Members

public string holoPath

Path for the prefab

public GameObject holoParent

Possible holographic parebn

public GameObject holoObject

The actual hologram

public inline void SetHoloObject(GameObject _holoObject)

Set Hologram Gameobject to class variable

Parameters
  • _holoObject

public inline  HoloGroup(string _holoPath,GameObject _holoParent)

Summary

public Action action Action to call after user completes this specific Action

public inline  IActionGroup(int _numberofPath,IAction _iAction,Action _action) Constructor to set each Action

Members

public int numberofPath

The number of scenegraph path that will be triggered by Perfrorming this Action

public Action action

Action to call after user completes this specific Action

public inline  IActionGroup(int _numberofPath,IAction _iAction,Action _action)

Constructor to set each Action

class MAGES::ActionPrototypes::RemoveAction::InsertGroup

For Remove Action we need an extra class to group the prefabs that will be spawned

Summary

public string grabbablePrefabPath Paths to the prefabs that will be spawned

public GameObject grabbablePrefab GameObjects of prefabs that will be spawned

public InheritTransformFrom inheritGrabbable Transforms of objects we need to spawn the prefabs in relative position

public inline  InsertGroup(string _grabbablePrefabPath,string _removeprefabPath,GameObject _parentPrefab,InheritTransformFrom _inheritGrabbable,InheritTransformFrom _inheritRemove) Constructor to generate an insert group

Members

public string grabbablePrefabPath

Paths to the prefabs that will be spawned

public GameObject grabbablePrefab

GameObjects of prefabs that will be spawned

public InheritTransformFrom inheritGrabbable

Transforms of objects we need to spawn the prefabs in relative position

public inline  InsertGroup(string _grabbablePrefabPath,string _removeprefabPath,GameObject _parentPrefab,InheritTransformFrom _inheritGrabbable,InheritTransformFrom _inheritRemove)

Constructor to generate an insert group

class MAGES::ActionPrototypes::InsertAction::InsertGroup

Helper class to group the insert Action prefabs

Summary

public string grabbablePrefabPath Paths to the prefabs that will spawned

public GameObject grabbablePrefab GameObjects to store spawned prefabs

public GameObject finalParent GameObject to set the parent of spawned prefab if needed

public InheritTransformFrom inheritGrabbable Transforms of objects we need to spawn the prefabs in relative position

public inline  InsertGroup(string _grabbablePrefabPath,string _finalPrefabPath,GameObject _finalParent,GameObject _grabbableParent,InheritTransformFrom _inheritGrabbable,InheritTransformFrom _inheritFinal) Constructor to generate an insert group

Members

public string grabbablePrefabPath

Paths to the prefabs that will spawned

public GameObject grabbablePrefab

GameObjects to store spawned prefabs

public GameObject finalParent

GameObject to set the parent of spawned prefab if needed

public InheritTransformFrom inheritGrabbable

Transforms of objects we need to spawn the prefabs in relative position

public inline  InsertGroup(string _grabbablePrefabPath,string _finalPrefabPath,GameObject _finalParent,GameObject _grabbableParent,InheritTransformFrom _inheritGrabbable,InheritTransformFrom _inheritFinal)

Constructor to generate an insert group

class MAGES::ActionPrototypes::BasePrototype::InstrumentTransforms

This class is used to store information about the instrument’s position There are some cases we want to know the position of an instrument to spawn another one relative to this position. This methodology is used in actions that user assembles instrumets. Since user handles the instruments with shis hand we need to sknow where those intstruments (or his hands) are located.

class MAGES::AutomaticDestroyFunctions::AutomaticObjectDestroyFuncs::PlayAnimationAfterEnable

class MAGES::AutomaticDestroyFunctions::AutomaticObjectDestroyFuncs::PlayAnimationAfterEnable
  : public MonoBehaviour

Interal class need to Play again animation if the action is perform before the animation finish Automatic removed when it is finished

Summary

public string prefabAnimName Animation name

Members

public string prefabAnimName

Animation name

class MAGES::ActionPrototypes::PumpAction::PumpGroup

For Pump Action we need an extra class to group the prefabs that will be spawned

Summary

public string pumpPrefabPath Paths to the prefabs that will be spawned

public Action performActionFunction Action call to invoke after completing all the pumps on a prefab (optional)

public GameObject pumpPrefab GameObjects of prefabs that will be spawned

public inline  PumpGroup(string _pumpPrefabPath,GameObject _pumpPrefabParent,Action _performActionFunction) Constructor to generate a PumpGroup

Members

public string pumpPrefabPath

Paths to the prefabs that will be spawned

public Action performActionFunction

Action call to invoke after completing all the pumps on a prefab (optional)

public GameObject pumpPrefab

GameObjects of prefabs that will be spawned

public inline  PumpGroup(string _pumpPrefabPath,GameObject _pumpPrefabParent,Action _performActionFunction)

Constructor to generate a PumpGroup