Skip to content

Workplaces

danielbekhter@gmail.com edited this page Feb 27, 2022 · 3 revisions

Scripts

These scripts implement the functionality related to Workplaces:

  • Workplace: defines serialisable classes for the workplace data model and its integral parts, such as devices, places, warnings, etc.
  • WorkplaceViewUpdater: script for the Workplace model's view updating functionality the sense of the MVC pattern. This functionality includes updating the objects in the AR scene when the underlying Workplace data model changes. This is done by reacting to the WorkplaceLoaded event. The WorkplaceViewUpdater script defines a ScriptableObject, which can be instantiated as an asset by right-clicking in the Project section of the Unity Editor and selecting Create -> WorkplaceModel -> WorkplaceViewUpdater. When instantiated, the WorkplaceViewUpdater asset is available independent of the scene.
  • WorkplaceController: This script derives from MonoBehaviour and is a component of the WorkplaceController GameObject in the Start scene. It is mainly responsible for creating and updating the Workplace data model in the sense of the MVC pattern.
  • WorkplaceManager: provides diverse methods for managing Workplaces, e.g., for calibration, to other scripts. Holds an instance of the Workplace data model as well as containers for positions of Workplace-related GameObjects in the scene.

Events

These events from the EventManager script are related to Workplaces:

  • ParseWorkplace signals that the Workplace-file JSON should be parsed.
  • WorkplaceParsed signals that the Workplace file has been parsed.
  • WorkplaceLoaded signals that the data from the workplace data model has been applied to the AR scene in the form of GameObjects.
  • CalibrateWorkplace signals that a new world origin has been set and now all Workplace locations need to be adjusted accordingly.
  • WorkplaceCalibrated signals that all positions have been adjusted relative to the world origin, i.e., the centre of the calibration marker.