< Summary

Class:BIWLoadingPlaceHolder
Assembly:BuilderInWorld
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/Scripts/BIWLoadingPlaceHolder.cs
Covered lines:18
Uncovered lines:5
Coverable lines:23
Total lines:54
Line coverage:78.2% (18 of 23)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
BIWLoadingPlaceHolder()0%110100%
Dispose()0%220100%
DestroyAfterAnimation()0%3.013088.89%
CheckIfAnimationHasFinish()0%11.088063.64%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/Scripts/BIWLoadingPlaceHolder.cs

#LineLine coverage
 1using System.Collections;
 2using System.Collections.Generic;
 3using UnityEngine;
 4
 5public class BIWLoadingPlaceHolder : MonoBehaviour
 6{
 7    [SerializeField] private Animator placeHolderAnimator;
 8    [SerializeField] private List<ParticleSystem> placeHolderParticleSystems;
 9
 110    private static readonly int disspose = Animator.StringToHash(EXIT_TRIGGER_NAME);
 11    private const string EXIT_TRIGGER_NAME = "Exit";
 12    private const string EXIT_ANIMATION_NAME = "Exit";
 13
 14    private Coroutine checkCoroutine;
 15    public void Dispose()
 16    {
 1617        if (checkCoroutine != null)
 118            CoroutineStarter.Stop(checkCoroutine);
 19
 1620        Destroy(gameObject);
 1621    }
 22
 23    public void DestroyAfterAnimation()
 24    {
 125        if (placeHolderAnimator == null)
 026            return;
 127        placeHolderAnimator.SetTrigger(disspose);
 28
 829        foreach (ParticleSystem placeHolderParticleSystem in placeHolderParticleSystems)
 30        {
 331            placeHolderParticleSystem.Stop(true, ParticleSystemStopBehavior.StopEmitting);
 32        }
 133        checkCoroutine = CoroutineStarter.Start(CheckIfAnimationHasFinish());
 134    }
 35
 36    IEnumerator CheckIfAnimationHasFinish()
 37    {
 138        yield return null;
 139        if (placeHolderAnimator != null)
 40        {
 141            bool isExitingAnimationActive = false;
 242            while (!isExitingAnimationActive)
 43            {
 244                if (placeHolderAnimator != null)
 245                    isExitingAnimationActive = placeHolderAnimator.GetCurrentAnimatorStateInfo(0).IsName(EXIT_ANIMATION_
 46                else
 047                    isExitingAnimationActive  = true;
 248                yield return null;
 49            }
 050            if (this != null)
 051                Destroy(gameObject);
 52        }
 053    }
 54}