< 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()
 1265625    {
 2106526        if (isTurning) {
 840927            this.MoveHoseHandle();
 840928        }
 1265629    }
 30
 61131    public bool getIsTurning() {
 61132        return this.isTurning;
 61133    }
 34
 35    public void ActivateHandleMovement(bool turningOn)
 52636    {
 52637        this.isTurning = true;
 52638        this.towardsRotation = turningOn ? this.onRotationQuat : this.offRotationQuat;
 52639    }
 40
 41    private void MoveHoseHandle()
 840942    {
 43        // Rotate from current rot to the quat rotation slowly
 840944        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
 893451        if (Quaternion.Angle(transform.localRotation, this.towardsRotation) == 0) {
 52552            this.isTurning = false;
 52553        }
 840954    }
 55}