< Summary

Class:PlatformControllerOpenExit
Assembly:Test
File(s):D:/--UnityProject/VR/VRExplorer_subjects/EscapeGameVR/Assets/Scripts/Test/VR/PlatformControllerOpenExit.cs
Covered lines:3
Uncovered lines:26
Coverable lines:29
Total lines:50
Line coverage:10.3% (3 of 29)
Covered branches:0
Total branches:0
Covered methods:1
Total methods:4
Method coverage:25% (1 of 4)

Coverage History

Metrics

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

File(s)

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

#LineLine coverage
 1using System.Collections;
 2using System.Collections.Generic;
 3using UnityEngine;
 4
 5public class PlatformControllerOpenExit : MonoBehaviour
 6{
 7    [SerializeField] private Animator exitAnim;
 8    [SerializeField] private AudioSource exitSound;
 9    private bool exitOpen;
 10
 11    private void Awake()
 612    {
 613        exitOpen = false;
 614    }
 15
 16    private void OnCollisionEnter(Collision collision) //Un appel par collision, donc si l'objet touche 6 autres objets,
 017    {
 18
 019        if (!exitOpen && collision.gameObject.layer == LayerMask.NameToLayer("ColoredCube"))
 020        {
 021            if (collision.gameObject.GetComponent<Renderer>().sharedMaterial == this.gameObject.GetComponent<Renderer>()
 22
 023            {
 024                exitAnim.SetTrigger("TriggerOpenExit");
 025                exitOpen = true;
 026                StartCoroutine(PlaySound());
 027            }
 028        }
 029    }
 30
 31    private void OnCollisionExit(Collision collision)
 032    {
 033        if (exitOpen && collision.gameObject.layer == LayerMask.NameToLayer("ColoredCube"))
 034        {
 035            if (collision.gameObject.GetComponent<Renderer>().sharedMaterial == this.gameObject.GetComponent<Renderer>()
 36
 037            {
 038                exitOpen = false;
 039                exitAnim.SetTrigger("TriggerCloseExit");
 040                StartCoroutine(PlaySound());
 041            }
 042        }
 043    }
 44
 45    private IEnumerator PlaySound()
 046    {
 047        yield return new WaitForSeconds(0.5f);
 048        exitSound.Play();
 049    }
 50}