< Summary

Class:DCL.Tutorial.TutorialStepAction
Assembly:Onboarding
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Tutorial/Scripts/TutorialStepAction.cs
Covered lines:15
Uncovered lines:3
Coverable lines:18
Total lines:51
Line coverage:83.3% (15 of 18)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
TutorialStepAction()0%110100%
Start()0%330100%
OnDestroy()0%220100%
Step_OnShowAnimationFinished()0%6200%
Step_OnJustAfterStepExecuted()0%220100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Tutorial/Scripts/TutorialStepAction.cs

#LineLine coverage
 1using UnityEngine;
 2
 3namespace DCL.Tutorial
 4{
 5    /// <summary>
 6    /// This class coordinates the step animations with the animations of any action object that can exist as child.
 7    /// </summary>
 8    public class TutorialStepAction : MonoBehaviour
 9    {
 110        protected static int KEY_LOOP_ANIMATOR_BOOL = Animator.StringToHash("KeyLoop");
 11
 12        [SerializeField] internal TutorialStep step;
 13
 14        private Animator actionAnimator;
 15
 16        private void Start()
 17        {
 318            actionAnimator = GetComponent<Animator>();
 19
 320            if (actionAnimator != null)
 321                actionAnimator.SetBool(KEY_LOOP_ANIMATOR_BOOL, false);
 22
 323            if (step != null)
 24            {
 325                step.OnShowAnimationFinished += Step_OnShowAnimationFinished;
 326                step.OnJustAfterStepExecuted += Step_OnJustAfterStepExecuted;
 27            }
 328        }
 29
 30        private void OnDestroy()
 31        {
 332            if (step != null)
 33            {
 334                step.OnShowAnimationFinished -= Step_OnShowAnimationFinished;
 335                step.OnJustAfterStepExecuted -= Step_OnJustAfterStepExecuted;
 36            }
 337        }
 38
 39        private void Step_OnShowAnimationFinished()
 40        {
 041            if (actionAnimator != null)
 042                actionAnimator.SetBool(KEY_LOOP_ANIMATOR_BOOL, true);
 043        }
 44
 45        private void Step_OnJustAfterStepExecuted()
 46        {
 347            if (actionAnimator != null)
 348                actionAnimator.SetBool(KEY_LOOP_ANIMATOR_BOOL, false);
 349        }
 50    }
 51}