< Summary

Class:PlatformMovement
Assembly:Test
File(s):D:/--UnityProject/VR/VRExplorer_projects_dataset/Parkinson-App-Virtual-Reality/Assets/Scripts/Test/PlatformMovement.cs
Covered lines:33
Uncovered lines:3
Coverable lines:36
Total lines:69
Line coverage:91.6% (33 of 36)
Covered branches:0
Total branches:0
Covered methods:6
Total methods:6
Method coverage:100% (6 of 6)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
PlatformMovement()0%000100%
Start()0%000100%
Update()0%000100%
MovePlatform()0%000100%
OnCollisionEnter(...)0%000100%
getFiftyPoints()0%00066.67%

File(s)

D:/--UnityProject/VR/VRExplorer_projects_dataset/Parkinson-App-Virtual-Reality/Assets/Scripts/Test/PlatformMovement.cs

#LineLine coverage
 1using System.Collections;
 2using System.Collections.Generic;
 3using TMPro;
 4using Unity.VisualScripting;
 5using UnityEditor;
 6using UnityEngine;
 7using UnityEngine.Events;
 8using UnityEngine.ProBuilder.Shapes;
 9using UnityEngine.WSA;
 10
 11public class PlatformMovement : MonoBehaviour
 12{
 13    [Header("Game Object Components")]
 14    [SerializeField] GameObject[] wayPoints;
 915    int indexWayPoint = 0;
 916    public float platformSpeed = 2f;
 17
 18    [Header("UI Components")]
 19    [SerializeField] Canvas congratulationsUI;
 20    [SerializeField] Canvas gemsChildUI;
 921    int total = 0;
 22    [SerializeField] TMP_Text gemsValueUI;
 23
 24    private void Start()
 825    {
 826        congratulationsUI.enabled = false;
 827        gemsChildUI.enabled = false;
 828    }
 29
 4164930    void Update() { MovePlatform(); }
 31
 32    void MovePlatform()
 1388333    {
 1388334        if (Vector3.Distance(transform.position, wayPoints[indexWayPoint].transform.position) < 0.1f)
 2835        {
 2836            indexWayPoint++;
 37
 2838            if (indexWayPoint >= wayPoints.Length)
 1239            {
 1240                indexWayPoint = 0;
 1241            }
 2842        }
 1388343        transform.position = Vector3.MoveTowards(transform.position, wayPoints[indexWayPoint].transform.position, platfo
 1388344    }
 45
 46    // nos da la colision con la cual colisiono el objeto
 47    private void OnCollisionEnter(Collision collision)
 1348    {
 1349        if (collision.gameObject.CompareTag("Gems"))
 1350        {
 1351            collision.gameObject.transform.SetParent(transform, true);
 1352            collision.transform.SetParent(transform, true);
 53            //collision.rigidbody.Sleep();
 54
 1355            getFiftyPoints();
 1356        }
 1357    }
 58
 59    public void getFiftyPoints()
 1360    {
 1361        total += 10;
 1362        gemsChildUI.enabled = true;
 1363        gemsValueUI.text = $" Score:{total}";
 1364        if (total == 50)
 065        {
 066            congratulationsUI.enabled = true;
 067        }
 1368    }
 69}