Merge pull request #29 from FizzyApple12/main
Partial fix for white screen and height adjuster
This commit is contained in:
commit
ffc6faeffd
File diff suppressed because it is too large
Load Diff
87
Assets/Script/HeightAdjuster.cs
Normal file
87
Assets/Script/HeightAdjuster.cs
Normal file
@ -0,0 +1,87 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
using System.IO;
|
||||
using UnityEngine.Networking;
|
||||
using System.Runtime.InteropServices;
|
||||
using System;
|
||||
|
||||
public class HeightAdjuster : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private double height = 0; // meters
|
||||
[SerializeField]
|
||||
private double upperLimit = 10; // meters
|
||||
[SerializeField]
|
||||
private double lowerLimit = -10; // meters
|
||||
|
||||
[Space]
|
||||
[SerializeField]
|
||||
private double adjustSpeed = 0.1; // meters per second
|
||||
|
||||
[Header("Components")]
|
||||
[SerializeField]
|
||||
private PanelButton incrementButton;
|
||||
[SerializeField]
|
||||
private PanelButton decrementButton;
|
||||
[SerializeField]
|
||||
private PanelButton resetButton;
|
||||
[SerializeField]
|
||||
private TextMeshPro counterTxt;
|
||||
[SerializeField]
|
||||
private Transform XROrigin;
|
||||
|
||||
private bool incrementing = false;
|
||||
private bool decrementing = false;
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (PlayerPrefs.HasKey("Height")) height = PlayerPrefs.GetFloat("Height");
|
||||
else SaveHeight();
|
||||
|
||||
incrementButton.ButtonPressed += StartIncrementing;
|
||||
incrementButton.ButtonReleased += StopIncrementing;
|
||||
|
||||
decrementButton.ButtonPressed += StartDecrementing;
|
||||
decrementButton.ButtonReleased += StopDecrementing;
|
||||
|
||||
resetButton.ButtonPressed += ResetHeight;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (incrementing) height += Time.deltaTime * adjustSpeed;
|
||||
if (decrementing) height -= Time.deltaTime * adjustSpeed;
|
||||
|
||||
if (height > upperLimit) height = upperLimit;
|
||||
if (height < lowerLimit) height = lowerLimit;
|
||||
|
||||
counterTxt.text = String.Format("{0:F2}m", height);
|
||||
XROrigin.position = new Vector3(XROrigin.position.x, (float) -height, XROrigin.position.z);
|
||||
}
|
||||
|
||||
private void StartIncrementing() { incrementing = true; }
|
||||
private void StartDecrementing() { decrementing = true; }
|
||||
|
||||
private void StopIncrementing()
|
||||
{
|
||||
incrementing = false;
|
||||
SaveHeight();
|
||||
}
|
||||
private void StopDecrementing()
|
||||
{
|
||||
decrementing = false;
|
||||
SaveHeight();
|
||||
}
|
||||
|
||||
private void ResetHeight()
|
||||
{
|
||||
height = 0;
|
||||
SaveHeight();
|
||||
}
|
||||
|
||||
private void SaveHeight() {
|
||||
PlayerPrefs.SetFloat("Height", (float) height);
|
||||
}
|
||||
}
|
11
Assets/Script/HeightAdjuster.cs.meta
Normal file
11
Assets/Script/HeightAdjuster.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 46aeec2d43d72c84a808e47673b6177f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"com.hecomi.uwindowcapture": "https://github.com/hecomi/uWindowCapture.git#upm",
|
||||
"com.unity.collab-proxy": "1.15.17",
|
||||
"com.unity.ide.rider": "3.0.13",
|
||||
"com.unity.ide.visualstudio": "2.0.15",
|
||||
|
@ -1,5 +1,12 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"com.hecomi.uwindowcapture": {
|
||||
"version": "https://github.com/hecomi/uWindowCapture.git#upm",
|
||||
"depth": 0,
|
||||
"source": "git",
|
||||
"dependencies": {},
|
||||
"hash": "0412fe09e11d3720197707a935f8114cc2454639"
|
||||
},
|
||||
"com.unity.burst": {
|
||||
"version": "1.6.5",
|
||||
"depth": 1,
|
||||
|
@ -134,11 +134,9 @@ PlayerSettings:
|
||||
16:10: 1
|
||||
16:9: 1
|
||||
Others: 1
|
||||
bundleVersion: 0.1.0
|
||||
bundleVersion: 0.1.1
|
||||
preloadedAssets:
|
||||
- {fileID: 11400000, guid: 74eeb7429f216ca45a7093c586513e98, type: 2}
|
||||
- {fileID: -6265376527240436808, guid: 5e2dc0db42cc5b3459a781fecb0b76f9, type: 2}
|
||||
- {fileID: -6348321304186183749, guid: 6460523340b221f4ea5611d2c011a26c, type: 2}
|
||||
metroInputSource: 0
|
||||
wsaTransparentSwapchain: 0
|
||||
m_HolographicPauseOnTrackingLoss: 1
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user