< Summary

Class:DCL.Tutorial.TutorialStep_BasicControls
Assembly:Onboarding
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Tutorial/Scripts/Steps/Initial/TutorialStep_BasicControls.cs
Covered lines:15
Uncovered lines:2
Coverable lines:17
Total lines:52
Line coverage:88.2% (15 of 17)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
OnStepStart()0%4.034087.5%
OnStepExecute()0%330100%
OnStepFinished()0%330100%
OnOkButtonClick()0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Tutorial/Scripts/Steps/Initial/TutorialStep_BasicControls.cs

#LineLine coverage
 1using System.Collections;
 2using UnityEngine;
 3using UnityEngine.UI;
 4
 5namespace DCL.Tutorial
 6{
 7    /// <summary>
 8    /// Class that represents the onboarding tutorial step related to the very basic controls.
 9    /// </summary>
 10    public class TutorialStep_BasicControls : TutorialStep
 11    {
 12        private const int TEACHER_CANVAS_SORT_ORDER_START = 4;
 13
 14        [SerializeField] AudioEvent audioEventSuccess;
 15        [SerializeField] Button okButton;
 16
 17        internal bool stepIsFinished = false;
 18        private int defaultTeacherCanvasSortOrder;
 19
 20        public override void OnStepStart()
 21        {
 122            base.OnStepStart();
 23
 124            CommonScriptableObjects.featureKeyTriggersBlocked.Set(true);
 25
 126            okButton.onClick.AddListener(OnOkButtonClick);
 27
 128            if (tutorialController.configuration.teacherCanvas != null)
 129                defaultTeacherCanvasSortOrder = tutorialController.configuration.teacherCanvas.sortingOrder;
 30
 131            tutorialController.SetTeacherCanvasSortingOrder(TEACHER_CANVAS_SORT_ORDER_START);
 32
 133            tutorialController.hudController?.taskbarHud?.SetVisibility(false);
 034        }
 35
 36        public override IEnumerator OnStepExecute()
 37        {
 438            yield return new WaitUntil(() => stepIsFinished);
 139            audioEventSuccess.Play(true);
 140        }
 41
 42        public override void OnStepFinished()
 43        {
 144            base.OnStepFinished();
 145            tutorialController.SetTeacherCanvasSortingOrder(defaultTeacherCanvasSortOrder);
 146            tutorialController.hudController?.taskbarHud?.SetVisibility(true);
 147            CommonScriptableObjects.featureKeyTriggersBlocked.Set(false);
 148        }
 49
 050        internal void OnOkButtonClick() { stepIsFinished = true; }
 51    }
 52}