< Summary

Class:DynamicMeshCutter.KnifePlaneBehaviour
Assembly:Test
File(s):E:/Unity/Unity Project/VR-Cooking-Demo/Assets/_Scripts/KnifePlaneBehaviour.cs
Covered lines:1
Uncovered lines:23
Coverable lines:24
Total lines:48
Line coverage:4.1% (1 of 24)
Covered branches:0
Total branches:0
Covered methods:1
Total methods:3
Method coverage:33.3% (1 of 3)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
KnifePlaneBehaviour()0%000100%
Cut()0%0000%
OnCreated(...)0%0000%

File(s)

E:/Unity/Unity Project/VR-Cooking-Demo/Assets/_Scripts/KnifePlaneBehaviour.cs

#LineLine coverage
 1/*
 2 *
 3 * Code modified by:
 4 *      Dimitrios Vlachos
 5 *      djv1@student.london.ac.uk
 6 *      dimitri.j.vlachos@gmail.com
 7 *
 8 */
 9
 10using UnityEngine;
 11using UnityEngine.XR.Interaction.Toolkit;
 12
 13namespace DynamicMeshCutter
 14{
 15    public class KnifePlaneBehaviour : CutterBehaviour
 16    {
 217        public float DebugPlaneLength = 2;
 18        public void Cut()
 019        {
 020            var roots = UnityEngine.SceneManagement.SceneManager.GetActiveScene().GetRootGameObjects();
 021            foreach (var root in roots)
 022            {
 023                if (!root.activeInHierarchy)
 024                    continue;
 025                var targets = root.GetComponentsInChildren<MeshTarget>();
 026                foreach (var target in targets)
 027                {
 028                    Cut(target, transform.position, transform.forward, null, OnCreated);
 029                }
 030            }
 031        }
 32
 33        void OnCreated(Info info, MeshCreationData cData)
 034        {
 035            MeshCreation.TranslateCreatedObjects(info, cData.CreatedObjects, cData.CreatedTargets, Separation);
 36
 37            // Add scripts to game object
 038            GameObject[] gameObjects = cData.CreatedObjects;
 39
 040            foreach (var gameObject in gameObjects) {
 041                gameObject.AddComponent<OffsetInteractable>();
 042                gameObject.AddComponent<FoodItem>();
 043                gameObject.GetComponent<FoodItem>().hasBeenCut = true;
 044                gameObject.layer = 6;
 045            }
 046        }
 47    }
 48}