< Summary

Class:PlatformMovement
Assembly:Test
File(s):D:/--UnityProject/VR/_____ISSTA 26/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/_____ISSTA 26/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;
 215    int indexWayPoint = 0;
 216    public float platformSpeed = 2f;
 17
 18    [Header("UI Components")]
 19    [SerializeField] Canvas congratulationsUI;
 20    [SerializeField] Canvas gemsChildUI;
 221    int total = 0;
 22    [SerializeField] TMP_Text gemsValueUI;
 23
 24    private void Start()
 125    {
 126        congratulationsUI.enabled = false;
 127        gemsChildUI.enabled = false;
 128    }
 29
 264330    void Update() { MovePlatform(); }
 31
 32    void MovePlatform()
 88133    {
 88134        if (Vector3.Distance(transform.position, wayPoints[indexWayPoint].transform.position) < 0.1f)
 935        {
 936            indexWayPoint++;
 37
 938            if (indexWayPoint >= wayPoints.Length)
 439            {
 440                indexWayPoint = 0;
 441            }
 942        }
 88143        transform.position = Vector3.MoveTowards(transform.position, wayPoints[indexWayPoint].transform.position, platfo
 88144    }
 45
 46    // nos da la colision con la cual colisiono el objeto
 47    private void OnCollisionEnter(Collision collision)
 148    {
 149        if (collision.gameObject.CompareTag("Gems"))
 150        {
 151            collision.gameObject.transform.SetParent(transform, true);
 152            collision.transform.SetParent(transform, true);
 53            //collision.rigidbody.Sleep();
 54
 155            getFiftyPoints();
 156        }
 157    }
 58
 59    public void getFiftyPoints()
 260    {
 261        total += 10;
 262        gemsChildUI.enabled = true;
 263        gemsValueUI.text = $" Score:{total}";
 264        if (total == 50)
 065        {
 066            congratulationsUI.enabled = true;
 067        }
 268    }
 69}