< 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()
 355425    {
 411426        if (isTurning) {
 56027            this.MoveHoseHandle();
 56028        }
 355429    }
 30
 3531    public bool getIsTurning() {
 3532        return this.isTurning;
 3533    }
 34
 35    public void ActivateHandleMovement(bool turningOn)
 3536    {
 3537        this.isTurning = true;
 3538        this.towardsRotation = turningOn ? this.onRotationQuat : this.offRotationQuat;
 3539    }
 40
 41    private void MoveHoseHandle()
 56042    {
 43        // Rotate from current rot to the quat rotation slowly
 56044        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
 59551        if (Quaternion.Angle(transform.localRotation, this.towardsRotation) == 0) {
 3552            this.isTurning = false;
 3553        }
 56054    }
 55}