Introduction¶
As mentioned before each step of a pipelined process is translated to an Action Script. This Script contains information to define the Action’s behavior.
The Action object reflects a flexible structural module, capable to generate complex behaviours from basic ones. This is also the concept idea behind scenegraph; provide developers with fundamental elements and tools to implement scenarios from basic principles. Each Action script describes the behaviour in means of physical actions in the virtual environment.
In technical details, each Action script implements the IAction interface, which defines the basic rules every Action should follow. This interface ensures that all Actions will have the same methods.
The methods and properties of IAction interface are explained in detail below.
/// <summary>
/// This Inteface nedds to be implemented for every Action
/// Describes the functionalities the Actions should have
/// </summary>
public interface IAction
{
/// <summary>
/// GameObject.name
/// </summary>
string ActionName
{
set;
get;
}
/// <summary>
/// The Gameobject refering to the current Action in Unity
/// This implements the core of unity's scenegraph.
/// </summary>
GameObject ActionNode
{
set;
get;
}
/// <summary>
/// Sets the alternative path for current Action
/// -1 : Default path
/// </summary>
int AlternativePath
{
set;
get;
}
/// <summary>
/// Go to Next Action
/// Completes the current Action by finilizing and cleaning it
/// Destroys prefabs, holograms
/// Also plays animations to set the next one
/// </summary>
void Perform();
/// <summary>
/// Go to Previous Action
/// Resets current Action by finilizing and cleaning it
/// Destroys prefabs, holograms
/// Plays Undo animations
/// </summary>
void Undo();
/// <summary>
/// Initialize current Action by spawning the necessary prefabs
/// Sets each Action properties to run correctly
/// </summary>
void Initialize();
/// <summary>
/// Sets Holograms for current Action depending on the difficulty
/// </summary>
void InitializeHolograms();
/// <summary>
/// Sest the difficulty/error colliders for the current Action depending on the difficulty
/// </summary>
void DifficultyRestrictions();
/// <summary>
/// Used only for Combined Actions
/// Sets the next sub-Action to run after Performing the current one
/// </summary>
/// <param name="action">The next Action to run</param>
void SetNextModule(Action action);
}
Action Prototypes¶
At this point, we have described the basic interface each Action should implement to initialized and performed properly. With this interface, a developer can generate action scripts that behave in a common ruleset, following the scenegraph pipeline.
To make our system more efficient we have to limit the capabilities of the Action entity to target simple but commonly used behaviours/tasks in training scenarios. Modelling those behaviours, we will generate a pool of generic behavioural patterns and tasks from which we will develop scenarios that are more specific.
Therefore, MAGES SDK introduces several specific Action behaviors that developers can utilize to simulate training scenarios. These are called Action Prototypes and are the following:
Each Action Prototype inherits from BasePrototype, an abstract class that utilizes a common set of methods and properties for every prototype.