diff --git a/Game/Assets/ResetPosition.cs b/Game/Assets/ResetPosition.cs deleted file mode 100644 index 661134b..0000000 --- a/Game/Assets/ResetPosition.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.SceneManagement; - -public class ResetPosition : MonoBehaviour -{ - private Vector3 initialPosition; - private Quaternion initialRotation; - - void Start() - { - // Store initial position and rotation at the start - initialPosition = transform.position; - initialRotation = transform.rotation; - } - - public void ResetingPosition() - { - // Reset the XR Rig to the stored position and rotation - transform.position = initialPosition; - transform.rotation = initialRotation; - } -} diff --git a/Game/Assets/Scripts/MemoriseInitialPosition.cs b/Game/Assets/Scripts/MemoriseInitialPosition.cs new file mode 100644 index 0000000..77522fc --- /dev/null +++ b/Game/Assets/Scripts/MemoriseInitialPosition.cs @@ -0,0 +1,27 @@ +/* + * Author: Wai Lam + * Date: 13/2/25 + * Description: Memorise the initial position of a game object and reset it when needed + */ + +using UnityEngine; + +public class MemoriseInitialPosition : MonoBehaviour +{ + private Vector3 _initialPosition; + private Quaternion _initialRotation; + + private void Start() + { + // Store initial position and rotation at the start + _initialPosition = transform.position; + _initialRotation = transform.rotation; + } + + public void ResetPosition() + { + // Reset the XR Rig to the stored position and rotation + transform.position = _initialPosition; + transform.rotation = _initialRotation; + } +} \ No newline at end of file diff --git a/Game/Assets/ResetPosition.cs.meta b/Game/Assets/Scripts/MemoriseInitialPosition.cs.meta similarity index 100% rename from Game/Assets/ResetPosition.cs.meta rename to Game/Assets/Scripts/MemoriseInitialPosition.cs.meta diff --git a/Game/Assets/Scripts/Sceneloader.cs b/Game/Assets/Scripts/Sceneloader.cs deleted file mode 100644 index f25cfc0..0000000 --- a/Game/Assets/Scripts/Sceneloader.cs +++ /dev/null @@ -1,26 +0,0 @@ -/* -Author: Wai Lam -Date: 7/2/25 -Description: Loading scene from start to game -*/ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.SceneManagement; - -public class Sceneloader : MonoBehaviour -{ - public string sceneName; // Name of the scene to load - - public void LoadScene() - { - if (!string.IsNullOrEmpty(sceneName)) - { - SceneManager.LoadScene(sceneName); - } - else - { - Debug.LogWarning("Scene name is not assigned!"); - } - } -}