< Summary

Class:DCL.Components.ConeShape
Assembly:MainScripts
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Components/ParametrizedShapes/ConeShape.cs
Covered lines:13
Uncovered lines:1
Coverable lines:14
Total lines:51
Line coverage:92.8% (13 of 14)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Model()0%110100%
GetDataFromJSON(...)0%110100%
ConeShape()0%110100%
GetClassId()0%2100%
GenerateGeometry()0%110100%
ShouldGenerateNewMesh(...)0%880100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Components/ParametrizedShapes/ConeShape.cs

#LineLine coverage
 1using DCL.Controllers;
 2using DCL.Helpers;
 3using DCL.Models;
 4using System;
 5using UnityEngine;
 6
 7namespace DCL.Components
 8{
 9    public class ConeShape : ParametrizedShape<ConeShape.Model>
 10    {
 11        [System.Serializable]
 12        new public class Model : BaseShape.Model
 13        {
 14            public float radiusTop = 0f;
 4215            public float radiusBottom = 1f;
 4216            public float segmentsHeight = 1f;
 4217            public float segmentsRadial = 36f;
 18            public bool openEnded = false;
 19            public float? radius;
 4220            public float arc = 360f;
 21
 1922            public override BaseModel GetDataFromJSON(string json) { return Utils.SafeFromJson<Model>(json); }
 23        }
 24
 3025        public ConeShape() { model = new Model(); }
 26
 027        public override int GetClassId() { return (int) CLASS_ID.CONE_SHAPE; }
 28
 29        public override Mesh GenerateGeometry()
 30        {
 831            var model = (Model) this.model;
 832            return PrimitiveMeshBuilder.BuildCone(50, model.radiusTop, model.radiusBottom, 2f, 0f, true, false);
 33        }
 34
 35        protected override bool ShouldGenerateNewMesh(BaseShape.Model newModel)
 36        {
 1937            if (currentMesh == null)
 1338                return true;
 39
 640            Model newConeModel = newModel as Model;
 641            var model = (Model) this.model;
 642            return newConeModel.radius != model.radius
 43                   || newConeModel.radiusTop != model.radiusTop
 44                   || newConeModel.radiusBottom != model.radiusBottom
 45                   || newConeModel.segmentsHeight != model.segmentsHeight
 46                   || newConeModel.segmentsRadial != model.segmentsRadial
 47                   || newConeModel.openEnded != model.openEnded
 48                   || newConeModel.arc != model.arc;
 49        }
 50    }
 51}