Modules

Modules are the main display function of Tutorial Objects. There are several built-in modules each contains different configurations. Two categories of modules are used in this package, including TargetModule and TimeModule. More modules would be added in the future update.

Modules consist of two types of class. HSVModuleConfig class contains various configuration of modules. HSVTutorialModule class utilizes the configuration stored in HSVModuleConfig class for displaying when Tutorial Object starts playing. Remember to subclass both when creating custom modules.

Each module config has its corresponding Module component. Please use correct module prefab for the configuration.

1. Module Configuration

  • Module Prefab: Module prefab spawned on runtime. Would be added under Canvas.

Make sure HSVTutorialModule component or its inherited module component is added to the module prefab when creating new one.

  • Mask Prefab: Prefab spawned by module for each target. It is mainly used for display purpose.

Make sure HSVUIMask component is added to the mask prefab when creating new one.

  • Override Sprite: Overrides mask prefab original sprite when module starts.

  • Override Mask Color: Should the mask prefab sprite color be overridden.

  • Color: Color of overridden sprite.

  • Instant Transition: Should module UI appear instantly or use fading in/out animation.

  • Smooth Value: Transition smoothing value.

  • Fade Time: Elapsed time of animation transition.

  • Custom Transition: Custom transition of module prefabs.

With custom transition, Tutorial Module would just enable/disable mask prefab when playing. You could use your own transition tool to do the action such as DOTWeen.

Please remember to call EndModule() method in Tutorial Module component when you are done with transition as this would set module playing status to PlayState.End.

2. Target Module

Modules used to track targets on the screen.

You need Targets added to the target list in order to use Target Module.

  • Follow Target: Should module follow target when overriding Target's Config.

  • Allow No Target: Should module still run when there is no target(This is used by Popup Module).

2.1 Arrow Module

Subclass of Target module. Modules spawn an arrow for each target. The arrow could be positioned manually or use built-in auto position calculation.

  • Arrow Size: Display arrow rect size.

  • Arrow Sprite Direction: Arrow pointing direction in the sprite.

The original pointing direction in the sprite. (1, 0, 0) is pointing right on the screen. Please specify this when using auto rotation.

  • Animate Arrow: Should arrow animate on screen. It would use animation curve to position itself.

  • Animation Curve: Displacement curve.

  • Animation Speed: Frequency of displacement.

  • Animation Magnitude: Displacement magnitude.

  • Auto Rotation: Should arrow auto rotates itself towards target.

  • Rotation: If auto rotation is not check, arrow rotates towards this value.

  • Auto Anchor: Should arrow automatically position around the target with respect to pivot point.

  • Pivot: Screen point used to auto anchor arrow around target.

  • Anchor: If not Auto Anchor, arrow will use this to position itself around target

Anchor point(0, 0) is at top left corner around target, (1, 1) is at bottom right corner around Target

  • Rect Offset: Offset displacement from the calculated Target's display rect size.

  • Track OffScreen: Should arrow continue pointing towards target when it is out of screen.

  • Screen Offset: Offset distance from edge of the screen when target is out of screen. 0 is at the edge of screen while 1 is at center of screen.

2.2 Focus Dim Module

Subclass of Target Module. Module would create a screen dimming effect to preset color while masking out Target area.

  • Rect Offset: Offset displacement from the calculated Target's display rect size. Position value increases mask display size.

2.3 Highlight Module

Subclass of Target Module. Module creates highlighting sprite on the Target position.

  • Rect Offset: Offset displacement from the calculated Target's display rect size. Position value increases mask display size.

2.4 Popup Module

Subclass of Target Module. Module creates displaying text on screen around Target.

  • Allow No Target: Should module continue working without a target. If check, it is similar to InfoDisplay Module.

  • Auto Anchor: Should arrow automatically position around the target with respect to pivot point.

  • Pivot: Screen point used to auto anchor arrow around target.

  • Anchor: If not Auto Anchor, arrow will use this to position itself around target

Anchor point(0, 0) is at top left corner around target, (1, 1) is at bottom right corner around Target.

  • Scale Animation: Should popup rect scale in/out gradually. Animation would use Smooth Value to do transition.

  • Display Rect: Size of the displaying rect

  • Track OffScreen: Should arrow continue pointing towards target when it is out of screen.

  • Screen Offset: Offset distance from edge of the screen when target is out of screen. 0 is at the edge of screen while 1 is at center of screen.

  • Override Font Style: Should module overrides prefab font style.

Popup Module is using Unity built-in TextMesh Pro to display text message. This option would override some display text configurations.

  • Display Message: Text message displayed.

2.5 Position Module

Subclass of Target Module. Module creates displaying icon on top of Target.

  • Position Offset: Display offset from target's world location.

  • Mask Size: Icon display rect size.

  • Display Arrow: Should display arrow around icon when icon is far from target.

  • Arrow Sprite: Overriding arrow sprite when display arrow enabled.

  • Arrow Color: Arrow display color.

  • Arrow Size: Arrow sprite rect size.

  • Arrow Sprite Direction: Original arrow sprite pointing direction. (0, 1, 0) means pointing upward.

  • Arrow Offset: Offset distance from display icon.

  • Track OffScreen: Should Position Module continue tracking target when it is out of screen.

  • Screen Offset: Offset distance from edge of the screen when target is out of screen. 0 is at the edge of screen while 1 is at center of screen. This is also used as screen bound to determine if target is out of screen.

  • Display Distance: Should Position Module display distance between target and Player or Camera.

  • Font Rect: Distance font display size and position.

  • Use Camera: Should use Camera as reference to calculate distance.

  • Distance Unit: Distance display unit (currently supports Meter, KiloMeter, Mile, Feet).

  • Distance Threshold: Minimum distance to enable distance display.

  • Override Font Style: Should override distance display font style.

3. Time Module

Module runs without target. Such as displaying information text when there is no target highlighting, or do a time delay on tutorial playing.

3.1 InfoDisplay Module

Subclass of Time Module. Similar to Popup module, this module is mainly used to display informative text message on screen.

  • Scale Animation: Should popup rect scale in/out gradually. Animation would use Smooth Value to do transition.

  • Display Rect: Size of the displaying rect.

  • Override Font Style: Should module overrides prefab font style.

Popup Module is using Unity built-in TextMesh Pro to display text message. This option would override some display text configurations.

  • Display Message: Text message displayed.

3.2 Time Delay Module

Subclass of Time Module. Module does not need mask prefab for displaying. Its main function is to delay next tutorial step by certain amount of time.

  • Delay Time: Elapsed time of this module.

  • Auto End Tutorial: Tutorial would automatically end when delay time elapsed. Otherwise, tutorial would be still in playing state and do nothing.

4. Custom Module

You can subclass HSVModuleConfig class, or HSVTargetModuleConfig and HSVTimeModuleConfig for your own custom module.

Remember to create new custom modules subclassing HSVTutorialModule or HSVTargetModule and HSVTimeModule when creating new module configs class

Last updated