< Summary

Class:BIWFloorLoading
Assembly:BuilderInWorld
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/BuilderMode/BIWFloorLoading.cs
Covered lines:2
Uncovered lines:10
Coverable lines:12
Total lines:34
Line coverage:16.6% (2 of 12)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Initialize(...)0%2100%
LateUpdate()0%3.882022.22%
GetCameraPlaneDistance(...)0%2100%

File(s)

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

#LineLine coverage
 1using System.Collections;
 2using System.Collections.Generic;
 3using UnityEngine;
 4
 5public class BIWFloorLoading : MonoBehaviour
 6{
 7    private Camera builderCamera = null;
 8
 9    private const float RELATIVE_SCALE_RATIO = 0.032f;
 10
 011    public void Initialize(Camera camera) { builderCamera = camera; }
 12
 13    private void LateUpdate()
 14    {
 22715        if ( builderCamera == null )
 22716            return;
 17
 018        Transform cameraTransform = builderCamera.transform;
 019        Quaternion cameraRotation = cameraTransform.rotation;
 020        Vector3 position = transform.position;
 21
 022        transform.LookAt(position + cameraRotation * Vector3.forward,
 23            cameraRotation * Vector3.up);
 24
 025        float dist = GetCameraPlaneDistance(builderCamera, position);
 026        transform.localScale = new Vector3(RELATIVE_SCALE_RATIO * dist, RELATIVE_SCALE_RATIO * dist, RELATIVE_SCALE_RATI
 027    }
 28
 29    private static float GetCameraPlaneDistance(Camera camera, Vector3 objectPosition)
 30    {
 031        Plane plane = new Plane(camera.transform.forward, camera.transform.position);
 032        return plane.GetDistanceToPoint(objectPosition);
 33    }
 34}