< Summary

Class:SpacialMovement
Assembly:Assembly-CSharp
File(s):File 1: D:/--UnityProject/VR/_____ISSTA 26/Island-Visualizer-PCVR/Assets/Scripts/Test/SpacialMovement.cs
File 2: E:/Unity/Unity Project/Island-Visualizer-PCVR/Assets/Scripts/Test/SpacialMovement.cs
Covered lines:70
Uncovered lines:22
Coverable lines:92
Total lines:79
Line coverage:76% (70 of 92)
Covered branches:0
Total branches:0
Covered methods:8
Total methods:8
Method coverage:100% (8 of 8)

Coverage History

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
File 1: SpacialMovement()0%000100%
File 1: Start()0%000100%
File 1: Update()0%00062.07%
File 1: startMovement()0%000100%
File 2: SpacialMovement()0%000100%
File 2: Start()0%000100%
File 2: Update()0%00062.07%
File 2: startMovement()0%000100%

File(s)

D:/--UnityProject/VR/_____ISSTA 26/Island-Visualizer-PCVR/Assets/Scripts/Test/SpacialMovement.cs

#LineLine coverage
 1using UnityEngine;
 2
 3public class SpacialMovement : MonoBehaviour
 4{
 115    public float moveSpeed = 10.0f; // Adjust this to control movement speed.
 116    public float rotationSpeed = 2.0f; // Adjust this to control rotation speed.
 117    public Vector2 limitX = new Vector2(490f, 560f);
 118    public Vector2 limitY = new Vector2(3.5f, 15f);
 119    public Vector2 limitZ = new Vector2(515f, 570f);
 1110    public float delayToStartMovement = 3f;
 1111    private float rotationX = 0.0f;
 1112    private float rotationY = 0.0f;
 1113    private bool allowMovement = false;
 14
 15    private void Start()
 616    {
 617        Cursor.visible = false;
 618        Invoke("startMovement", delayToStartMovement);
 619        rotationX = transform.rotation.eulerAngles.x;
 620        rotationY = transform.rotation.eulerAngles.y;
 621    }
 22
 23    private void Update()
 94224    {
 141925        if (!allowMovement) return;
 26        // Handle movement using WASD or arrow keys.
 46527        float horizontalInput = Input.GetAxis("Horizontal");
 46528        float verticalInput = Input.GetAxis("Vertical");
 29
 46530        Vector3 movement = new Vector3(horizontalInput, 0.0f, verticalInput) * moveSpeed * Time.deltaTime;
 46531        transform.Translate(movement);
 32
 33        // Get mouse input
 46534        float mouseX = Input.GetAxis("Mouse X");
 46535        float mouseY = Input.GetAxis("Mouse Y");
 36
 37        // Calculate the new rotations
 46538        rotationY += mouseX * rotationSpeed;
 46539        rotationX -= mouseY * rotationSpeed;
 40
 41        // Clamp the vertical rotation to prevent flipping
 46542        rotationX = Mathf.Clamp(rotationX, -90f, 90f);
 43
 44        // Apply the rotations to the GameObject
 46545        transform.rotation = Quaternion.Euler(rotationX, rotationY, 0.0f);
 46
 47        // Handle upward movement using the space key.
 46548        if (Input.GetKey(KeyCode.Space))
 049        {
 050            Vector3 upMovement = Vector3.up * moveSpeed * Time.deltaTime;
 051            transform.Translate(upMovement);
 052        }
 53
 54        // Handle downward movement using the left control key.
 46555        if (Input.GetKey(KeyCode.LeftControl))
 056        {
 057            Vector3 downMovement = Vector3.down * moveSpeed * Time.deltaTime;
 058            transform.Translate(downMovement);
 059        }
 60
 46561        transform.position = new Vector3
 62        (
 63            Mathf.Clamp(transform.position.x, limitX.x, limitX.y),
 64            Mathf.Clamp(transform.position.y, limitY.x, limitY.y),
 65            Mathf.Clamp(transform.position.z, limitZ.x, limitZ.y)
 66        );
 67
 46568        if(Input.GetKeyDown("escape"))
 069        {
 070            Application.Quit();
 071        }
 94272    }
 73
 74    private void startMovement()
 475    {
 476        allowMovement = true;
 477    }
 78}
 79

E:/Unity/Unity Project/Island-Visualizer-PCVR/Assets/Scripts/Test/SpacialMovement.cs

File 'E:/Unity/Unity Project/Island-Visualizer-PCVR/Assets/Scripts/Test/SpacialMovement.cs' does not exist (any more).