< Summary

Class:InterpolatorControl
Assembly:InfiniteFloor
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Rendering/InfiniteFloor/RoundEdgesInterControl/InterpolatorControl.cs
Covered lines:0
Uncovered lines:15
Coverable lines:15
Total lines:73
Line coverage:0% (0 of 15)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%2100%
Start()0%2100%
Update()0%2100%
GetFogColor()0%2100%
SetFogColor()0%2100%
GetVertexColor(...)0%2100%
GetInfiniteFloorColors()0%12300%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Rendering/InfiniteFloor/RoundEdgesInterControl/InterpolatorControl.cs

#LineLine coverage
 1using System;
 2using System.Collections;
 3using System.Collections.Generic;
 4using UnityEngine;
 5
 6public class InterpolatorControl : MonoBehaviour
 7{
 8
 9    [SerializeField] private Color fogColor;
 10
 11    [SerializeField] private Color[] infiniteFloorFogColors;
 12    [SerializeField] private Color infiniteFloorFogColor;
 13
 14    [SerializeField] private Material roundEdgesInterpolatorMat;
 15
 16    [SerializeField] private GameObject infiniteFloor;
 17
 18    private void Awake()
 19    {
 020        roundEdgesInterpolatorMat = transform.GetComponent<SkinnedMeshRenderer>().material;
 021    }
 22    // Start is called before the first frame update
 23    void Start()
 24    {
 25
 026    }
 27
 28    // Update is called once per frame
 29    void Update()
 30    {
 031        GetFogColor();
 32        //SetFogColor();
 33
 34        //infiniteFloorFogColor = GetVertexColor(1);
 35        //infiniteFloorFogColors = GetInfiniteFloorColors();
 36
 37        //infiniteFloorFogColor = infiniteFloorFogColors[1];
 38
 039    }
 40
 41    private void GetFogColor()
 42    {
 043        fogColor = RenderSettings.fogColor;
 044    }
 45
 46    private void SetFogColor()
 47    {
 048        roundEdgesInterpolatorMat.SetColor("_FogColor", fogColor);
 049    }
 50
 51    // get color from an objects vertex
 52    private Color GetVertexColor(int vertexIndex)
 53    {
 054        Color[] colors = new Color[transform.GetComponent<SkinnedMeshRenderer>().sharedMesh.vertexCount];
 55        //transform.GetComponent<SkinnedMeshRenderer>().sharedMesh.colors = colors;
 56        //return colors[vertexIndex];
 57
 58        // get mesh colors from infiniteFloor
 059        Color[] infiniteFloorColors = infiniteFloor.GetComponent<MeshRenderer>().sharedMaterial.GetColorArray("_Colors")
 60
 61        // return
 062        return infiniteFloorColors[vertexIndex];
 63
 64    }
 65
 66    // get colors of infinite floor
 67    private Color[] GetInfiniteFloorColors()
 68    {
 069        Color[] infiniteFloorColors = infiniteFloor.GetComponent<MeshRenderer>().sharedMaterial.GetColorArray("_Colors")
 070        Debug.Log("infiniteFloorColors: " + infiniteFloorColors);
 071        return infiniteFloorColors;
 72    }
 73}