< Summary

Class:PlatformController
Assembly:Test
File(s):D:/--UnityProject/VR/VRExplorer_subjects/EscapeGameVR/Assets/Scripts/Test/VR/PlatformController.cs
Covered lines:24
Uncovered lines:4
Coverable lines:28
Total lines:54
Line coverage:85.7% (24 of 28)
Covered branches:0
Total branches:0
Covered methods:3
Total methods:3
Method coverage:100% (3 of 3)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%000100%
OnCollisionEnter(...)0%00071.43%
OnCollisionExit(...)0%000100%

File(s)

D:/--UnityProject/VR/VRExplorer_subjects/EscapeGameVR/Assets/Scripts/Test/VR/PlatformController.cs

#LineLine coverage
 1using System.Collections;
 2using System.Collections.Generic;
 3using UnityEngine;
 4
 5
 6public class PlatformController : MonoBehaviour
 7{
 8    [SerializeField] private Vector3 arcPosition;
 9    [SerializeField] private GameObject arcPrefab;
 10    [SerializeField] private int numberOfPlatform;
 11    [SerializeField] private Vector3 rotation;
 12
 13    private static int numberCorrectCube;
 14    private static bool arcDroped;
 15    private Quaternion arcRotation;
 16    // Start is called before the first frame update
 17    void Awake()
 2418    {
 2419        numberCorrectCube = 0;
 2420        arcDroped = false;
 2421        arcRotation = Quaternion.Euler(rotation);
 2422    }
 23
 24    private void OnCollisionEnter(Collision collision) //Un appel par collision, donc si l'objet touche 6 autres objets,
 1525    {
 26
 1527        if (collision.gameObject.layer == LayerMask.NameToLayer("ColoredCube"))
 1528        {
 1529            if (collision.gameObject.GetComponent<Renderer>().sharedMaterial == this.gameObject.GetComponent<Renderer>()
 30
 831            {
 832                numberCorrectCube++;
 833                if (numberCorrectCube == numberOfPlatform)
 034                {
 035                    Instantiate(arcPrefab, arcPosition, arcRotation);
 036                    arcDroped = true;
 037                }
 838            }
 1539        }
 1540    }
 41
 42    private void OnCollisionExit(Collision collision)
 1143    {
 1144        if (collision.gameObject.layer == LayerMask.NameToLayer("ColoredCube"))
 1145        {
 1146            if (collision.gameObject.GetComponent<Renderer>().sharedMaterial == this.gameObject.GetComponent<Renderer>()
 47
 748            {
 749                numberCorrectCube--;
 750            }
 1151        }
 1152    }
 53
 54}