locomotion fix & skybox addition

- Added skybox control
- Added "SkySeries Freebie" skyboxes
- Changed hand orbs' material to be solidly Unlit
- Changed locomotion toggle to be Trigger on both hands
- Fixed control panel's messy text pivots
This commit is contained in:
msk
2022-05-25 02:17:16 -07:00
parent cc66b70b58
commit c1a0aa505f
170 changed files with 13790 additions and 1342 deletions
+3
View File
@@ -49,6 +49,9 @@ public class LocomotionToggle : MonoBehaviour
soundOn = Resources.Load<AudioClip>("Audio/loco on");
soundOff = Resources.Load<AudioClip>("Audio/loco off");
leftHandAction.action.Enable();
rightHandAction.action.Enable();
leftHandAction.action.started +=
(InputAction.CallbackContext _) => leftHeld = true;
leftHandAction.action.canceled +=
+5
View File
@@ -11,6 +11,9 @@ public class PanelButton : MonoBehaviour
[DllImport("user32.dll")]
static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, UIntPtr dwExtraInfo);
public event Action ButtonPressed;
public event Action ButtonReleased;
public VirtualKeyCode key;
public VirtualKeyCode key2;
@@ -62,6 +65,7 @@ public class PanelButton : MonoBehaviour
private void ButtonPress()
{
ButtonPressed?.Invoke();
if (isToggle)
{
if (!isOn)
@@ -89,6 +93,7 @@ public class PanelButton : MonoBehaviour
private void ButtonRelease()
{
ButtonReleased?.Invoke();
keybd_event(System.Convert.ToByte(key), (byte)MapVirtualKey((uint)key, 0), 2, UIntPtr.Zero);
keybd_event(System.Convert.ToByte(key2), (byte)MapVirtualKey((uint)key2, 0), 2, UIntPtr.Zero);
if (!isToggle)
@@ -2,12 +2,13 @@ using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class PanelLocker : MonoBehaviour
public class PanelHiderButton : MonoBehaviour
{
private int colliderCount = 0;
private bool isLocked = false;
private float timer = 0f;
private bool actionTaken = false;
private Renderer r;
[Header("Settings")]
[SerializeField]
@@ -35,17 +36,20 @@ public class PanelLocker : MonoBehaviour
private void Start()
{
r = GetComponent<Renderer>();
statusImg.texture = isLocked ? lockImg : unlockImg;
audioSrc.clip = lockSound;
}
private void OnTriggerEnter(Collider _)
{
r.material.color = Color.white;
++colliderCount;
}
private void OnTriggerExit(Collider _)
{
r.material.color = Color.gray;
colliderCount = Mathf.Clamp(colliderCount - 1, 0, colliderCount);
}
+47
View File
@@ -0,0 +1,47 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class SkyboxSwitcher : MonoBehaviour
{
[SerializeField]
private List<Material> skyboxes;
[SerializeField]
private int currentSkyboxIndex; // should start at 0
[Header("Components")]
[SerializeField]
private PanelButton incrementBtn;
[SerializeField]
private PanelButton decrementBtn;
[SerializeField]
private TextMeshPro counterTxt;
// Start is called before the first frame update
void Start()
{
incrementBtn.ButtonPressed += IncrementEvent;
decrementBtn.ButtonPressed += DecrementEvent;
//skyboxes.Insert(0, Resources.Load<Material>("unity_builtin_extra/Default-Skybox")); // results in plain blue??? not the ubiquitous unity default
skyboxes.Insert(0, RenderSettings.skybox); // add ubiquitous default skybox (should be current)
SetSkybox();
}
private void IncrementEvent()
{
currentSkyboxIndex = (currentSkyboxIndex + 1) % skyboxes.Count;
SetSkybox();
}
private void DecrementEvent()
{
if (--currentSkyboxIndex < 0)
currentSkyboxIndex = skyboxes.Count - 1;
SetSkybox();
}
private void SetSkybox()
{
counterTxt.text = (currentSkyboxIndex + 1).ToString();
RenderSettings.skybox = skyboxes[currentSkyboxIndex];
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d9d7372274e9214429d55ed4ef283584
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: