< Summary

Class:BIWLoadingPlaceHolder
Assembly:BuilderInWorld
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/BuilderMode/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/Scripts/MainScripts/DCL/Controllers/BuilderMode/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    {
 917        if (checkCoroutine != null)
 818            CoroutineStarter.Stop(checkCoroutine);
 19
 920        Destroy(gameObject);
 921    }
 22
 23    public void DestroyAfterAnimation()
 24    {
 825        if (placeHolderAnimator == null)
 026            return;
 827        placeHolderAnimator.SetTrigger(disspose);
 28
 6429        foreach (ParticleSystem placeHolderParticleSystem in placeHolderParticleSystems)
 30        {
 2431            placeHolderParticleSystem.Stop(true, ParticleSystemStopBehavior.StopEmitting);
 32        }
 833        checkCoroutine = CoroutineStarter.Start(CheckIfAnimationHasFinish());
 834    }
 35
 36    IEnumerator CheckIfAnimationHasFinish()
 37    {
 838        yield return null;
 839        if (placeHolderAnimator != null)
 40        {
 841            bool isExitingAnimationActive = false;
 3242            while (!isExitingAnimationActive)
 43            {
 3244                if (placeHolderAnimator != null)
 3245                    isExitingAnimationActive = placeHolderAnimator.GetCurrentAnimatorStateInfo(0).IsName(EXIT_ANIMATION_
 46                else
 047                    isExitingAnimationActive  = true;
 3248                yield return null;
 49            }
 050            if (this != null)
 051                Destroy(gameObject);
 52        }
 053    }
 54}