< Summary

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

Metrics

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

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        {
 018            actionAnimator = GetComponent<Animator>();
 19
 020            if (actionAnimator != null)
 021                actionAnimator.SetBool(KEY_LOOP_ANIMATOR_BOOL, false);
 22
 023            if (step != null)
 24            {
 025                step.OnShowAnimationFinished += Step_OnShowAnimationFinished;
 026                step.OnJustAfterStepExecuted += Step_OnJustAfterStepExecuted;
 27            }
 028        }
 29
 30        private void OnDestroy()
 31        {
 032            if (step != null)
 33            {
 034                step.OnShowAnimationFinished -= Step_OnShowAnimationFinished;
 035                step.OnJustAfterStepExecuted -= Step_OnJustAfterStepExecuted;
 36            }
 037        }
 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        {
 047            if (actionAnimator != null)
 048                actionAnimator.SetBool(KEY_LOOP_ANIMATOR_BOOL, false);
 049        }
 50    }
 51}