< Summary

Class:DCL.Tutorial.TutorialTeacher
Assembly:Onboarding
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Tutorial/Scripts/TutorialTeacher.cs
Covered lines:11
Uncovered lines:2
Coverable lines:13
Total lines:56
Line coverage:84.6% (11 of 13)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
PlayAnimation(...)0%5.025090.91%
PlaySpeakSound()0%2100%
PlayHappySound(...)0%110100%

File(s)

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

#LineLine coverage
 1using UnityEngine;
 2
 3namespace DCL.Tutorial
 4{
 5    /// <summary>
 6    /// This class controls the behaviour of the teacher (a 3D model character) that will be guiding to the player along
 7    /// </summary>
 8    public class TutorialTeacher : MonoBehaviour
 9    {
 10        public enum TeacherAnimation
 11        {
 12            StepCompleted,
 13            QuickGoodbye,
 14            Reset
 15        }
 16
 17        [SerializeField] internal Animator teacherAnimator;
 18
 19        [SerializeField]
 20        AudioEvent audioEventHappy, audioEventNormal;
 21
 22        [HideInInspector] public bool isHiddenByAnAnimation = false;
 23
 24        /// <summary>
 25        /// Play an animation.
 26        /// </summary>
 27        /// <param name="animation">Animation to play.</param>
 28        public void PlayAnimation(TeacherAnimation animation)
 29        {
 2830            if (!isActiveAndEnabled)
 031                return;
 32
 33            switch (animation)
 34            {
 35                case TeacherAnimation.StepCompleted:
 2036                    teacherAnimator.SetTrigger("StepCompleted");
 2037                    PlayHappySound(0.3f);
 2038                    break;
 39                case TeacherAnimation.QuickGoodbye:
 540                    teacherAnimator.SetTrigger("QuickGoodbye");
 541                    isHiddenByAnAnimation = true;
 542                    break;
 43                case TeacherAnimation.Reset:
 344                    teacherAnimator.SetTrigger("Reset");
 345                    isHiddenByAnAnimation = false;
 46                    break;
 47                default:
 48                    break;
 49            }
 350        }
 51
 052        public void PlaySpeakSound() { audioEventNormal.PlayScheduled(0.4f); }
 53
 4054        public void PlayHappySound(float delay) { audioEventHappy.PlayScheduled(delay); }
 55    }
 56}