< Summary

Class:HoseHandleMovement
Assembly:Test
File(s):D:/--UnityProject/VR/_____ISSTA 26/vr-firefighter-simulator/Assets/Test/HoseHandleMovement.cs
Covered lines:25
Uncovered lines:0
Coverable lines:25
Total lines:55
Line coverage:100% (25 of 25)
Covered branches:0
Total branches:0
Covered methods:5
Total methods:5
Method coverage:100% (5 of 5)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%000100%
Update()0%000100%
getIsTurning()0%000100%
ActivateHandleMovement(...)0%000100%
MoveHoseHandle()0%000100%

File(s)

D:/--UnityProject/VR/_____ISSTA 26/vr-firefighter-simulator/Assets/Test/HoseHandleMovement.cs

#LineLine coverage
 1using UnityEngine;
 2
 3public class HoseHandleMovement : MonoBehaviour
 4{
 5    public Vector3 onRotation;
 6    public Vector3 offRotation;
 7    public float rotationSpeed;
 8    private float step;
 9    private Quaternion onRotationQuat;
 10    private Quaternion offRotationQuat;
 11    private Quaternion towardsRotation;
 12    private bool isTurning;
 13
 14
 15    void Awake()
 116    {
 117        this.isTurning = false;
 118        this.step = this.rotationSpeed * Time.deltaTime;
 119        this.onRotationQuat = Quaternion.Euler(this.onRotation);
 120        this.offRotationQuat = Quaternion.Euler(this.offRotation);
 121        this.transform.localRotation = this.offRotationQuat;
 122    }
 23
 24    void Update()
 1178925    {
 1791726        if (isTurning) {
 612827            this.MoveHoseHandle();
 612828        }
 1178929    }
 30
 38431    public bool getIsTurning() {
 38432        return this.isTurning;
 38433    }
 34
 35    public void ActivateHandleMovement(bool turningOn)
 38336    {
 38337        this.isTurning = true;
 38338        this.towardsRotation = turningOn ? this.onRotationQuat : this.offRotationQuat;
 38339    }
 40
 41    private void MoveHoseHandle()
 612842    {
 43        // Rotate from current rot to the quat rotation slowly
 612844        transform.localRotation = Quaternion.RotateTowards(
 45            transform.localRotation,
 46            this.towardsRotation,
 47            this.step
 48        );
 49
 50        // When the turning has finalized, set the flag to false to avoid movement
 651151        if (Quaternion.Angle(transform.localRotation, this.towardsRotation) == 0) {
 38352            this.isTurning = false;
 38353        }
 612854    }
 55}