< Summary

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

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
BIWLoadingPlaceHolder()0%110100%
Dispose()0%6200%
DestroyAfterAnimation()0%12300%
CheckIfAnimationHasFinish()0%72800%

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    {
 017        if (checkCoroutine != null)
 018            CoroutineStarter.Stop(checkCoroutine);
 19
 020        Destroy(gameObject);
 021    }
 22
 23    public void DestroyAfterAnimation()
 24    {
 025        if (placeHolderAnimator == null)
 026            return;
 027        placeHolderAnimator.SetTrigger(disspose);
 28
 029        foreach (ParticleSystem placeHolderParticleSystem in placeHolderParticleSystems)
 30        {
 031            placeHolderParticleSystem.Stop(true, ParticleSystemStopBehavior.StopEmitting);
 32        }
 033        checkCoroutine = CoroutineStarter.Start(CheckIfAnimationHasFinish());
 034    }
 35
 36    IEnumerator CheckIfAnimationHasFinish()
 37    {
 038        yield return null;
 039        if (placeHolderAnimator != null)
 40        {
 041            bool isExitingAnimationActive = false;
 042            while (!isExitingAnimationActive)
 43            {
 044                if (placeHolderAnimator != null)
 045                    isExitingAnimationActive = placeHolderAnimator.GetCurrentAnimatorStateInfo(0).IsName(EXIT_ANIMATION_
 46                else
 047                    isExitingAnimationActive  = true;
 048                yield return null;
 49            }
 050            if (this != null)
 051                Destroy(gameObject);
 52        }
 053    }
 54}