< Summary

Class:DCL.StickersController
Assembly:MainScripts
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/StickersController/StickersController.cs
Covered lines:4
Uncovered lines:11
Coverable lines:15
Total lines:37
Line coverage:26.6% (4 of 15)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%110100%
PlaySticker(...)0%2100%
PlaySticker(...)0%15.555025%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/StickersController/StickersController.cs

#LineLine coverage
 1using UnityEngine;
 2
 3namespace DCL
 4{
 5    public class StickersController : MonoBehaviour
 6    {
 7        private StickersFactory stickersFactory;
 8
 25669        private void Awake() { stickersFactory = Resources.Load<StickersFactory>("StickersFactory"); }
 10
 11        public void PlaySticker(string id)
 12        {
 013            PlaySticker(id, transform.position, Vector3.zero, true);
 014        }
 15
 16        public void PlaySticker(string id, Vector3 position, Vector3 direction, bool followTransform)
 17        {
 5418            if (stickersFactory == null || !stickersFactory.TryGet(id, out GameObject prefab))
 019                return;
 20
 21            // TODO(Brian): Mock this system properly through our service locators or plugin system
 5422            if (DCL.Configuration.EnvironmentSettings.RUNNING_TESTS)
 5423                return;
 24
 025            GameObject emoteGameObject = Instantiate(prefab);
 026            emoteGameObject.transform.position += position;
 027            emoteGameObject.transform.rotation = Quaternion.Euler(prefab.transform.rotation.eulerAngles + direction);
 28
 029            if (followTransform)
 30            {
 031                FollowObject emoteFollow = emoteGameObject.AddComponent<FollowObject>();
 032                emoteFollow.target = transform;
 033                emoteFollow.offset = prefab.transform.position;
 34            }
 035        }
 36    }
 37}