diff --git a/Game/Assets/Scripts/CameraFollower.cs b/Game/Assets/Scripts/CameraFollower.cs new file mode 100644 index 0000000..b5f3175 --- /dev/null +++ b/Game/Assets/Scripts/CameraFollower.cs @@ -0,0 +1,24 @@ +/* + * Author: Mark + * Date: 16/2/25 + * Description: follows the XR Camera's position + */ + +using System; +using UnityEngine; + +public class XRColliderFollow : MonoBehaviour +{ + [SerializeField] private Transform xrCamera; + + private void Awake() + { + if (xrCamera != null) return; + throw new Exception("Please assign the XR Camera to the XRColliderFollow script!"); + } + + private void Update() + { + transform.position = xrCamera.position; + } +} \ No newline at end of file diff --git a/Game/Assets/Scripts/CameraFollower.cs.meta b/Game/Assets/Scripts/CameraFollower.cs.meta new file mode 100644 index 0000000..ca47c52 --- /dev/null +++ b/Game/Assets/Scripts/CameraFollower.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 27b115b1b7297054cabb4ec1e403b751 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Game/Assets/Scripts/TriggerFunctionRemapper.cs b/Game/Assets/Scripts/TriggerFunctionRemapper.cs new file mode 100644 index 0000000..1bede63 --- /dev/null +++ b/Game/Assets/Scripts/TriggerFunctionRemapper.cs @@ -0,0 +1,23 @@ +/* + * Author: Mark + * Date: 16/2/25 + * Description: allows changing what code is executed when a trigger is entered + */ + +using System; +using UnityEngine; + +public class TriggerFunctionRemapper : MonoBehaviour +{ + private Action _onTriggerEnter; + + private void OnTriggerEnter(Collider other) + { + _onTriggerEnter?.Invoke(other); + } + + public void Remap(Action func) + { + _onTriggerEnter = func; + } +} \ No newline at end of file diff --git a/Game/Assets/Scripts/TriggerFunctionRemapper.cs.meta b/Game/Assets/Scripts/TriggerFunctionRemapper.cs.meta new file mode 100644 index 0000000..2ec8f06 --- /dev/null +++ b/Game/Assets/Scripts/TriggerFunctionRemapper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 396d8c6bf380c7241bc652343cbf11f6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: