< Summary

Class:PlatformMovement
Assembly:Test
File(s):E:/Unity/Unity Project/Parkinson-App-Virtual-Reality/Assets/Scripts/Test/PlatformMovement.cs
Covered lines:28
Uncovered lines:8
Coverable lines:36
Total lines:69
Line coverage:77.7% (28 of 36)
Covered branches:0
Total branches:0
Covered methods:5
Total methods:6
Method coverage:83.3% (5 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%0000%
getFiftyPoints()0%000100%

File(s)

E:/Unity/Unity Project/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;
 415    int indexWayPoint = 0;
 416    public float platformSpeed = 2f;
 17
 18    [Header("UI Components")]
 19    [SerializeField] Canvas congratulationsUI;
 20    [SerializeField] Canvas gemsChildUI;
 421    int total = 0;
 22    [SerializeField] TMP_Text gemsValueUI;
 23
 24    private void Start()
 225    {
 226        congratulationsUI.enabled = false;
 227        gemsChildUI.enabled = false;
 228    }
 29
 620130    void Update() { MovePlatform(); }
 31
 32    void MovePlatform()
 206733    {
 206734        if (Vector3.Distance(transform.position, wayPoints[indexWayPoint].transform.position) < 0.1f)
 435        {
 436            indexWayPoint++;
 37
 438            if (indexWayPoint >= wayPoints.Length)
 139            {
 140                indexWayPoint = 0;
 141            }
 442        }
 206743        transform.position = Vector3.MoveTowards(transform.position, wayPoints[indexWayPoint].transform.position, platfo
 206744    }
 45
 46    // nos da la colision con la cual colisiono el objeto
 47    private void OnCollisionEnter(Collision collision)
 048    {
 049        if (collision.gameObject.CompareTag("Gems"))
 050        {
 051            collision.gameObject.transform.SetParent(transform, true);
 052            collision.transform.SetParent(transform, true);
 53            //collision.rigidbody.Sleep();
 54
 055            getFiftyPoints();
 056        }
 057    }
 58
 59    public void getFiftyPoints()
 560    {
 561        total += 10;
 562        gemsChildUI.enabled = true;
 563        gemsValueUI.text = $" Score:{total}";
 564        if (total == 50)
 165        {
 166            congratulationsUI.enabled = true;
 167        }
 568    }
 69}