< Summary

Class:Builder.Gizmos.DCLBuilderGizmoAxis
Assembly:Builder
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Builder/Scripts/Gizmos/DCLBuilderGizmoAxis.cs
Covered lines:0
Uncovered lines:23
Coverable lines:23
Total lines:61
Line coverage:0% (0 of 23)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
SetGizmo(...)0%2100%
GetGizmo()0%2100%
SetColorHighlight()0%6200%
SetColorDefault()0%6200%
Awake()0%6200%
Start()0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Builder/Scripts/Gizmos/DCLBuilderGizmoAxis.cs

#LineLine coverage
 1using UnityEngine;
 2using System;
 3
 4namespace Builder.Gizmos
 5{
 6    public class DCLBuilderGizmoAxis : MonoBehaviour
 7    {
 8        public Color defaultColor;
 9        public Color highLightColor;
 10        public Renderer objectRenderer;
 11
 12        MaterialPropertyBlock props;
 13
 14        static int colorPropertyID;
 15        static bool isColorPropertyIdSet = false;
 16
 17        private DCLBuilderGizmo gizmo = null;
 18
 019        public void SetGizmo(DCLBuilderGizmo parentGizmo) { gizmo = parentGizmo; }
 20
 021        public DCLBuilderGizmo GetGizmo() { return gizmo; }
 22
 23        public void SetColorHighlight()
 24        {
 025            if (props == null)
 026                return;
 27
 028            objectRenderer.GetPropertyBlock(props);
 029            props.SetColor(colorPropertyID, highLightColor);
 030            objectRenderer.SetPropertyBlock(props);
 31
 032        }
 33
 34        public void SetColorDefault()
 35        {
 036            if (props == null)
 037                return;
 38
 039            objectRenderer.GetPropertyBlock(props);
 040            props.SetColor(colorPropertyID, defaultColor);
 041            objectRenderer.SetPropertyBlock(props);
 042        }
 43
 44        private void Awake()
 45        {
 046            if (!isColorPropertyIdSet)
 47            {
 048                isColorPropertyIdSet = true;
 049                colorPropertyID = Shader.PropertyToID("_BaseColor");
 50            }
 051        }
 52
 53        private void Start()
 54        {
 055            props = new MaterialPropertyBlock();
 056            objectRenderer.GetPropertyBlock(props);
 057            props.SetColor(colorPropertyID, defaultColor);
 058            objectRenderer.SetPropertyBlock(props);
 059        }
 60    }
 61}