< 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
 183030    void Update() { MovePlatform(); }
 31
 32    void MovePlatform()
 61033    {
 61034        if (Vector3.Distance(transform.position, wayPoints[indexWayPoint].transform.position) < 0.1f)
 635        {
 636            indexWayPoint++;
 37
 638            if (indexWayPoint >= wayPoints.Length)
 339            {
 340                indexWayPoint = 0;
 341            }
 642        }
 61043        transform.position = Vector3.MoveTowards(transform.position, wayPoints[indexWayPoint].transform.position, platfo
 61044    }
 45
 46    // nos da la colision con la cual colisiono el objeto
 47    private void OnCollisionEnter(Collision collision)
 348    {
 349        if (collision.gameObject.CompareTag("Gems"))
 350        {
 351            collision.gameObject.transform.SetParent(transform, true);
 352            collision.transform.SetParent(transform, true);
 53            //collision.rigidbody.Sleep();
 54
 355            getFiftyPoints();
 356        }
 357    }
 58
 59    public void getFiftyPoints()
 460    {
 461        total += 10;
 462        gemsChildUI.enabled = true;
 463        gemsValueUI.text = $" Score:{total}";
 464        if (total == 50)
 065        {
 066            congratulationsUI.enabled = true;
 067        }
 468    }
 69}